if(document.getElementById)
{
	window.alert=function(txt)
	{
		createAlertBox(txt);		
	}
	window.confirm=function(txt)
	{
		createConfirmBox(txt);
	}
}
function getScroll()
{
alert(document.body.scrollTop);
alert(document.body.style.height);
}
function createAlertBox(txt)
{
	txt = txt.replace('\n',"<br>");
	d=document;
	if(d.getElementById("divContainer1"))return;
	pObj=d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
	pObj.id="divContainer1";
	pObj.style.border="0px";
	pObj.style.height=document.body.scrollHeight+"px";
	pObj.style.width=document.body.scrollWidth+"px";
	//document.getElementById('divContainer1').style.height=document.body.scrollHeight+"1000px";
	//ifObj=pObj.appendChild(d.createElement("iframe"));
	//ifObj.id="divFrame1";
	//ifObj.style.height=document.body.scrollHeight+"px";
	//ifObj.style.width=document.body.scrollWidth+"px";
	//document.getElementById('divFrame1').allowtransparency='true';
	//document.getElementById('divFrame1').style.height=document.body.scrollHeight+"px";
	alertObj=pObj.appendChild(d.createElement("div"));
	alertObj.id="boxB1";
	if(d.all&&!window.opera)alertObj.style.top=document.documentElement.scrollTop+"px";
	alertObj.style.left=(d.documentElement.scrollWidth-alertObj.offsetWidth)/2+"px";
	if(document.getElementById('popUp')){
		document.getElementById('popUp').style.height=document.body.scrollHeight+"px";
		document.getElementById('popUp').style.display = "";
	}
	//alrtHdr = "<div style='cursor: move;border:0px red solid'></div>";
	/*alrtHdr ="<table border='1' cellpadding='0' cellspacing='0' width='100%' height='100%'>"+
	"<tr><td valign='middle' class='clsErr'>"+
	"<table border='0' cellpadding='0' cellspacing='0' width='100%' height='100%'>"+
	"<tr><td valign='middle' style='padding-top:20px' class='clsErr'>"+
	"<table align='center' border='0'  cellspacing='0' bordercolor='#999999' cellpadding='5' style='padding-left:10px;padding-top:15px' valign='middle' class='clsErr' width='100%'>";
	alrtFtr="<tr><td align='center' valign='middle'><img onclick='clickCancel();return false;' src='Common/Images/cancelbtn.gif' style='border:0px;cursor:pointer'></td></tr>"+
	"</table></td></tr></table></td></tr></table></div></div>";*/
	
	alrtHdr = "<table border='0' cellpadding='0' cellspacing='0' bordercolor='#CCCCCC'>"+
	"<tr>"+
		"<td>"+
			"<table border='0' cellpadding='0' cellspacing='0'>"+
				"<tr>"+
					"<td style='background-image:url(Common/Images/popup_lt.gif);background-repeat:repeat;width:12px' class='trans'></td>"+
					"<td style='background-image:url(Common/Images/popup_tm.gif);background-repeat:repeat;height:42px' class='trans'>"+
						"<table border='0' cellpadding='0' cellspacing='0' width='100%'>"+

							"<tr>"+

								"<td align='center' style='padding-left:0px;font-family:Helvetica;font-weight:bold;font-size:14px;width:210px;' id='titleText'>Bestagno Olive Oil</td>"+

								"<td align='center' style='cursor:pointer;width:18px'><img src='Common/Images/close1.gif' border='0' alt='' onclick='clickCancel()'></td>"+

							"</tr>"+

						"</table>"
						+"</td>"+
					"<td style='background-image:url(Common/Images/popup_rt.gif);background-repeat:repeat;width:12px' class='trans'></td>"+
				"</tr>"+
				"<tr>"+
					"<td style='background-color:#abc095;border-left:1px solid #366712' class='trans'>&nbsp;</td>"+
					"<td style='background-color:#abc095' class='trans'>"+
						"<table border='0' cellpadding='0' cellspacing='0'>"+
							"<tr>"+
								"<td>"+
									"<table border='0' cellpadding='0' cellspacing='0' >"+
										"<tr>"+
											"<td style='padding-top:2px;' id='titleText'>"+
												
											"</td>"+
										"</tr>"+
										"<tr>"+
											"<td id='errBlackText' style='padding-left:33px;padding-right:8px'>";
	alrtFtr =									"</td>"+
										"</tr>"+
										"<tr>"+
											"<td align='center' style='padding-top:5px'><img onclick='clickCancel();return false;' src='Common/Images/cancelbtn.gif' style='border:0px;cursor:pointer'></td>"+
										"</tr>"+
										
									"</table>"+
								"</td>"+
							"</tr>"+
						"</table>"+
					"</td>"+
					"<td style='background-color:#abc095;border-right:1px solid #366712' class='trans'>&nbsp;</td>"+
				"</tr>"+
				"<tr>"+
					"<td style='height:12px;background-image:url(Common/Images/popup_lb.gif);background-repeat:repeat;width:12px'></td>"+
					"<td style='height:12px;background-image:url(Common/Images/popup_mb.gif);background-repeat:repeat;'></td>"+
					"<td style='height:12px;background-image:url(Common/Images/popup_rb.gif);background-repeat:repeat;width:12px' ></td>"+
				"</tr>"+
		   "</table>"+
		"</td>"+
	"</tr>"+
"</table>"+
"</div></div>";
	
	//alertCont.innerHTML = txt
	alertObj.innerHTML=alrtHdr+txt+alrtFtr;
	//divTop = document.body.scrollTop+(document.body.clientHeight/2)-(document.getElementById('boxB1').style.height/2);
	divTop = document.body.scrollTop+(document.body.clientHeight/2)-60;
	document.getElementById('popUp').style.height = document.body.clientHeight+"px";
	document.getElementById('boxB1').style.top= divTop+"px";
	//alertObj.innerHTML=alrtHdr;
}
function createConfirmBox(txt)
{
	d=document;
	newTxt = new Array();
	newTxt = txt.split("::");
 
	if(newTxt[0] == "L")
	  var fnCon ="fnLo();";
	else if(newTxt[0] == "D")
		  var fnCon ="fnDelete(newTxt[2]);";
	else if(newTxt[0] == "R")
		 var fnCon ="fnAddRequest(newTxt[2],1);";
	else if(newTxt[0] == "Reg")
		  var fnCon ="fnredirect()";
	if(d.getElementById("divContainer1"))return;
	pObj=d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
	pObj.id="divContainer1";
	pObj.style.border="0px";
	pObj.style.height=document.body.scrollHeight+"px";
	pObj.style.width=document.body.scrollWidth+"px";
	//document.getElementById('divContainer1').style.height=document.body.scrollHeight+"1000px";
	ifObj=pObj.appendChild(d.createElement("iframe"));
	ifObj.id="divFrame1";
	ifObj.style.height=document.body.scrollHeight+"px";
	ifObj.style.width=document.body.scrollWidth+"px";
	document.getElementById('divFrame1').allowtransparency='true';
	//document.getElementById('divFrame1').style.height=document.body.scrollHeight+"px";
	alertObj=pObj.appendChild(d.createElement("div"));
	alertObj.id="boxB1";
	if(d.all&&!window.opera)alertObj.style.top=document.documentElement.scrollTop+"px";
	alertObj.style.left=(d.documentElement.scrollWidth-alertObj.offsetWidth)/2+"px";
	if(document.getElementById('popUp'))
		document.getElementById('popUp').style.display = "";
	if(newTxt[0]=='M'||newTxt[0]=='SU') {
		var cont = "&nbsp;";
	}
	else {
		var cont = "<img onclick='"+fnCon+";return false;' src='Common/Images/cancelbtn.gif' style='border:0px;cursor:pointer'>";
	}
	alrtHdr = "<table border='0' cellpadding='0' cellspacing='0' bordercolor='#CCCCCC'>"+
	"<tr>"+
		"<td>"+
			"<table border='0' cellpadding='0' cellspacing='0'>"+
				"<tr>"+
					"<td style='height:10px;background-image:url(images/popup_left_top.gif);background-repeat:repeat;width:10px' class='trans'></td>"+
					"<td style='background-image:url(images/popup_mid_top.gif);background-repeat:repeat;height:10px' class='trans'></td>"+
					"<td style='height:10px;background-image:url(images/popup_right_top.gif);background-repeat:repeat;width:10px' class='trans'></td>"+
				"</tr>"+
				"<tr>"+
					"<td style='background-image:url(images/popup_mid_left.gif);background-repeat:repeat' class='trans'>&nbsp;</td>"+
					"<td style='background-image:url(images/popup_midd.gif);background-repeat:repeat' class='trans'>"+
						"<table border='0' cellpadding='0' cellspacing='0'>"+
							"<tr>"+
								"<td>"+
									"<table border='0' cellpadding='0' cellspacing='0' >"+
										"<tr>"+
											"<td style='padding-top:2px;' id='titleText'>"+
												"<table border='0' cellpadding='0' cellspacing='0' width='100%'>"+
													"<tr>"+
														"<td align='center style='padding-left:0px;font-family:Helvetica;font-weight:bold;font-size:14px;width:180px;' id='titleText'>TheGemRunner.com</td>"+
														"<td align='center' style='cursor:pointer;width:18px'><img src='Common/Images/close1.gif' border='0' alt='' onclick='clickCancel()'></td>"+
													"</tr>"+
												"</table>"+
											"</td>"+
										"</tr>"+
										"<tr>"+
											"<td id='errBlackText' style='padding-left:33px;padding-right:8px'>";
	alrtFtr =									"</td>"+
										"</tr>"+
										"<tr>"+
											"<td align='center' style='padding-top:5px'><table border='0' cellpadding='0' cellspacing='0'><tr><td valign='middle'>"+cont+"</td>";
	if(newTxt[0] == 'M'){
		alrtReg = "</tr><tr><td><a href='javascript:void(0)' onclick='clickCancel();return false;'><img src='images/continue.gif' border='0' alt='Continue' title='Continue'></a></td></tr><tr><td style='padding-top:10px;'><a href='info.php'><img src='images/myrequest.gif' border='0' alt='My Request' title='My Request'></a></td></tr><tr><td style='padding-top:10px;'><a href='http://www.telicenterprises.com/projects/igl1.05/gemrunner/'><img src='images/home.gif' border='0' alt='Home' title='Home'></a></td></tr>";

   
	}else if(newTxt[0] == 'SU'){
		alrtReg = "</tr><tr><td><a href='javascript:void(0)' onclick='clickCancel();return false;'><img src='images/continue.gif' border='0' alt='Continue' title='Continue'></a></td></tr>";
   
	}else{	
		alrtReg = "<td style='width:10px'></td><td valign='middle'><img onclick='clickCancel();return false;' src='Common/Images/cancel-button.gif' style='border:0px;cursor:pointer'></td>";   	
	}
	alrtFtr1 =	"</table></td>"+
										"</tr>"+										
									"</table>"+
								"</td>"+
							"</tr>"+
						"</table>"+
					"</td>"+
					"<td style='background-image:url(images/popup_mid_right.gif);background-repeat:repeat' class='trans'>&nbsp;</td>"+
				"</tr>"+
				"<tr>"+
					"<td style='height:10px;background-image:url(images/popup_left_bottom.gif);background-repeat:repeat;width:10px' class='trans'></td>"+
					"<td style='background-image:url(images/popup_mid_bottom.gif);background-repeat:repeat;height:10px' class='trans'></td>"+
					"<td style='height:10px;background-image:url(images/popup_right_bottom.gif);background-repeat:repeat;width:10px' class='trans'></td>"+
				"</tr>"+
		   "</table>"+
		"</td>"+
	"</tr>"+
"</table>"+
"</div></div>";
	if(newTxt[0]=='Reg') {
		alertObj.innerHTML=alrtHdr+newTxt[1]+alrtFtr+alrtFtr1;
	}
	else {
 		alertObj.innerHTML=alrtHdr+newTxt[1]+alrtFtr+alrtReg+alrtFtr1;
 	}
	//alertObj.innerHTML=alrtHdr+newTxt[1]+alrtFtr;
	divTop = document.body.scrollTop+(document.body.clientHeight/2)-60;
	document.getElementById('boxB1').style.top= divTop+"px";
}
function clickCancel()
{
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("divContainer1"));
	if(document.getElementById('popUp'))
		document.getElementById('popUp').style.display = "none";

}
function clickOk()
{
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("divContainer"));
	validateuser();
}
function fnLo(){
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("divContainer1"));
	window.location.href='logout.php';
	//action="delete";
	//window.location.href="view_request.php?action="+action+"&id="+id+"&b="+b;
 }
 function fnredirect() {
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("divContainer1"));
	window.location.href = "index.php";
}
 





 