function openWin(pagename,w,h){
	microsite_window=window.open(pagename,'microsite_window','toolbar=no,location=no,borders=no,directories=no,status=no,menubar=no,scrollbars=yes,top=0,left=0,resizable=no,width='+w+',height='+h)
}
//////////////////////////////////////     
var xmlHttp
function showpage(ctlName,page){
//	alert(ctlName+"\n"+page);
	var xmlHttp = GetXmlHttpObject();
	var url = page+"&sid="+Math.random();
	if (!xmlHttp){
		alert ("Browser does not support HTTP Request")
		return
	}
	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
			document.getElementById(ctlName).innerHTML=xmlHttp.responseText;
		}else if(xmlHttp.readyState==3){
			document.getElementById(ctlName).innerHTML="<center><br><br>Loading Data......</center>";
		}
	};
	xmlHttp.open("GET", url, true);
	xmlHttp.send(null);
}
function GetXmlHttpObject(){ 
var objXMLHttp=null;

     if (window.XMLHttpRequest){
          objXMLHttp=new XMLHttpRequest();
     }else if (window.ActiveXObject){
          objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
     }
     return objXMLHttp;
}
//////////////////////////////////////
function addMoreDefImg(){
	
	var totOpt = (parseInt(document.getElementById('totOptions').value)+1);

	var tbl = document.getElementById('tblAdd');
	nR = tbl.insertRow(tbl.rows.length-2);
	nC = nR.insertCell(0);
	nC.setAttribute("height", "20");
	nC.setAttribute("valign", "top");
	nC.innerHTML = '<strong>Image Title '+totOpt+':</strong>';

	nC = nR.insertCell(1);
	nC.setAttribute("height", "20");
	nC.setAttribute("valign", "top");
	nC.innerHTML = '<input name="imgname_'+totOpt+'" type="text" class="txtfld" id="imgname_'+totOpt+'" size="75">';
	
	nR = tbl.insertRow(tbl.rows.length-2);
	nC = nR.insertCell(0);
	nC.setAttribute("height", "20");
	nC.setAttribute("valign", "top");
	nC.innerHTML = '<strong>Image '+totOpt+':</strong>';

	nC = nR.insertCell(1);
	nC.setAttribute("height", "20");
	nC.setAttribute("valign", "top");
	nC.innerHTML = '<input name="img_'+totOpt+'" type="file" class="txtfld" id="img_'+totOpt+'" size="60">';

	document.getElementById('totOptions').value= (totOpt);
	document.getElementById("imgname_"+totOpt).focus();
}
function addMoreOpt(){
	
	var totOpt = (parseInt(document.getElementById('totOptions').value)+1);

	var tbl = document.getElementById('tblAddG');
	nR = tbl.insertRow(tbl.rows.length-2);
	nC = nR.insertCell(0);
	nC.setAttribute("height", "20");
	nC.setAttribute("valign", "top");
	nC.innerHTML = '<strong>Image '+totOpt+':</strong>';

	nC = nR.insertCell(1);
	nC.setAttribute("height", "20");
	nC.setAttribute("valign", "top");
	nC.innerHTML = '<input name="gimg_'+totOpt+'" type="file" class="txtfld" id="gimg_'+totOpt+'" size="45">';

	document.getElementById('totOptions').value= (totOpt);
	document.getElementById("gimg_"+totOpt).focus();
}
///////////////////////////////
function test(obj,msg) {
	var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
	if (regex.test(obj.value)){
		return true;
	}else{
		alert(msg);
		obj.focus();
		return false;
	}
}
function checkempty(obj,msg){
	if(obj.value==""){
		alert(msg);
		obj.focus();
		return false;
	}
}
function checkint(obj,msg){
	if(isNaN(obj.value)){
		alert(msg);
		obj.focus();
		return false;
	}
}
function confirmPassword(obj,obj1,msg){
	if(!(obj.value==obj1.value)){
		alert(msg);
		obj1.focus();
		return false;
	}
}
function isnumber(obj,msg){
	if(isNaN(obj.value)){
		alert(msg);
		obj.focus();
		return false;
	}
}
function isZero(obj,msg){
	if((obj.value)==0){
		alert(msg);
		obj.focus();
		return false;
	}
}
function checkAll(theForm, cName, allNo_stat){
	var n=theForm.elements.length;
	for (var i=0;i<n;i++){
		if (theForm.elements[i].className.indexOf(cName) !=-1){
			if (allNo_stat.checked) {
				theForm.elements[i].checked = true;
			}else{
				theForm.elements[i].checked = false;
			}
		}
	}
}
///////////////////////////
///////Admin Scripts///////
///////////////////////////
function chkLogin(){
	if (checkempty(document.frmLogin.usrname,"Information - Enter Username")==false) return false;
	if (checkempty(document.frmLogin.password,"Information - Enter Password")==false) return false;
	return true;
}
function passcheck(){
	if (checkempty(document.frmChangePass.OPass,"Information - Enter Old Password")==false) return false;
	if (checkempty(document.frmChangePass.NPass,"Information - Enter New Password")==false) return false;
	if (checkempty(document.frmChangePass.CPass,"Information - Enter Confirm Password")==false) return false;
	if (confirmPassword(document.frmChangePass.NPass,document.frmChangePass.CPass,"Information - New and Confirm Password must be same")==false) return false;
	return true;
}
function chkAddCat(){
	if (checkempty(document.form1.catname1,"Information - Enter Category Name")==false) return false;
	return true;
}
function chkAddDefImg(){
	if (checkempty(document.form1.location,"Information - Select Location")==false) return false;
	if (checkempty(document.form1.imgname_1,"Information - Enter Image Title")==false) return false;
	return true;
}
function chkAddPage(){
	if (checkempty(document.form1.ptitle1,"Information - Enter Page Heading")==false) return false;
	return true;
}
function ChkAddPrjForm(){
	if (checkempty(document.frmAddPrj.refid,"Information - Enter Project's Reference ID")==false) return false;
	if (checkempty(document.frmAddPrj.pname,"Information - Enter Project's Name")==false) return false;
	return true;
}
function checkNews(){
	if (checkempty(document.frmNews.ntitle,"Information - Enter News Heading")==false) return false;
	if (checkempty(document.frmNews.ndate,"Information - Enter Date")==false) return false;
	return true;
}
function chkAddGImg(){
	if (checkempty(document.form1.gimgname1,"Information - Enter Image Title")==false) return false;
	if (checkempty(document.form1.simg1,"Information - Select Small Image")==false) return false;
	if (checkempty(document.form1.limg1,"Information - Select Large Image")==false) return false;
	return true;
}