function none() {};

<!-- Web Site:  http://dynamicdrive.com -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function disableForm(theform) {
	if (document.all || document.getElementById) {
		for (i = 0; i < theform.length; i++) {
			var tempobj = theform.elements[i];
			if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
				tempobj.disabled = true;
		}
		
		setTimeout('alert("Your form has been submitted.  ")', 2000);
		return true;
		
	} else {
		alert("The form has been submitted.  Do not click the submit button again.");
		return false;
	}
}
//  End -->

/*
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;
*/

function hidediv(pass) { 
	var divs = document.getElementsByTagName('div'); 
	for(i=0;i<divs.length;i++){ 
		if(divs[i].id.match(pass)){//if they are 'see' divs 
		
		
		
			if (document.getElementById) // DOM3 = IE5, NS6 
				divs[i].style.visibility="hidden";// show/hide 
			else 
				if (document.layers) // Netscape 4 
					document.layers[divs[i]].display = 'hidden'; 
				else // IE 4 
					document.all.hideshow.divs[i].visibility = 'hidden'; 
		} 
	} 
}


function showdiv(pass) { 
	var divs = document.getElementsByTagName('div'); 
	for(i=0;i<divs.length;i++){ 
		if(divs[i].id.match(pass)){ 
			if (document.getElementById) 
				divs[i].style.visibility="visible"; 
			else 
				if (document.layers) // Netscape 4 
					document.layers[divs[i]].display = 'visible'; 
				else // IE 4 
					document.all.hideshow.divs[i].visibility = 'visible'; 
		} 
	} 
} 

function setfocus() {
	document.login.username.focus();
	return;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//window.name='parentwin';


function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 

function formprevpage(pagenum)
{
	parent.location=pagenum;
	parent.focus();
}

function jumptopage(jumppagenumber)
{	
	document.forms[0].jumppagenumber.value=jumppagenumber;
	document.forms[0].submit();
	return false;
}



function newslettersubscribe()
{

// set url value
var listid = document.getElementById("listid").value;
var signupemail = document.getElementById("signupemail").value;
var url="/cmsadmin/ajax/ajaxnewslettersubscribe.php?listid=" + listid;
url=url+"&signupemail="+signupemail;
if(document.getElementById("firstname")){url=url+"&firstname="+document.getElementById("firstname").value;};
if(document.getElementById("lastname")){url=url+"&lastname="+document.getElementById("lastname").value;};

// show loading gif
document.getElementById("newsletterform").style.textAlign = 'center';
document.getElementById("newsletterform").innerHTML='<img src="/images/ajaxloadbluecircle.gif" width="32" height="32" border="0">';

if (window.XMLHttpRequest)
  {
  xmlHttp=new window.XMLHttpRequest();
  }
else // for older IE 5/6
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlHttp.open("GET",url,false);
xmlHttp.send(null);
document.getElementById("newsletterform").innerHTML=xmlHttp.responseText;
}




function ajaxrecoverpassword()
{

if(document.forgotpassword.registeredemail.value == "")
{
strMsg = "Registered email cannot be blank";
alert(strMsg);
document.forgotpassword.registeredemail.focus();
return false;
}
function isValidEmail(strEmail){
	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	// search email text for regular exp matches
	if (strEmail.search(validRegExp) == -1) 
	{
	return false;
	} 
	return true; 
}
var thevalue = document.forgotpassword.registeredemail.value;
if(!isValidEmail(thevalue))
{
strMsg = thevalue + " is not valid email format";
alert(strMsg);
document.forgotpassword.registeredemail.focus();
return false;
}

// set url value
var registeredemail = document.forgotpassword.registeredemail.value;
var req = document.forgotpassword.req.value;
var url="/cmsadmin/ajax/ajaxrecoverpassword.php?req="+req+"&registeredemail=" + registeredemail;

// show loading gif
document.getElementById("contactloginform").innerHTML='<img src="/images/ajaxloadbluecircle.gif" width="32" height="32" border="0">';

if (window.XMLHttpRequest)
  {
  xmlHttp=new window.XMLHttpRequest();
  }
else // for older IE 5/6
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlHttp.open("GET",url,false);
xmlHttp.send(null);
document.getElementById("contactloginform").innerHTML=xmlHttp.responseText;
}





function ajaxrecoveradminpassword()
{
	var url="forgotpassword.php";
	
	// show loading gif
	document.getElementById("adminloginform").innerHTML='<img src="../images/ajaxloadbluecircle.gif" width="32" height="32" border="0">';
	if (window.XMLHttpRequest)
	  {
	  xmlHttp=new window.XMLHttpRequest();
	  }
	else // for older IE 5/6
	  {
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlHttp.open("GET",url,false);
	xmlHttp.send(null);
	document.getElementById("adminloginform").innerHTML=xmlHttp.responseText;
	
}





function ajaxeditpage(pageid)
{

// set url value
var url="/cmsadmin/ajaxeditpage.php?id=" + pageid;
document.getElementById("bodytext").innerHTML='<img src="images/ajaxloadbluecircle.gif" width="32" height="32" border="0">';

if (window.XMLHttpRequest)
  {
  xmlHttp=new window.XMLHttpRequest();
  }
else // for older IE 5/6
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlHttp.open("GET",url,false);
xmlHttp.send(null);
document.getElementById("bodytext").innerHTML=xmlHttp.responseText;
}



function ajaxupdatepage()
{

// set url value
var url="/cmsadmin/ajax/ajaxeditpage.php?";
if(document.getElementById("Body")){url=url+"&Body="+document.getElementById("Body").value;};
if(document.getElementById("id")){url=url+"&id="+document.getElementById("id").value;};
if(document.getElementById("act")){url=url+"&act="+document.getElementById("act").value;};

// show loading gif
document.getElementById("bodytext").innerHTML='<img src="/images/ajaxloadbluecircle.gif" width="32" height="32" border="0">';

if (window.XMLHttpRequest)
  {
  xmlHttp=new window.XMLHttpRequest();
  }
else // for older IE 5/6
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlHttp.open("GET",url,false);
xmlHttp.send(null);
document.getElementById("bodytext").innerHTML=xmlHttp.responseText;
}





function ajaxgalleryrefresh(pageid)
{
	var url="/cmsadmin/ajax/ajaxgalleryrefresh.php?id=" + pageid;
	
	// show loading gif
	if (window.XMLHttpRequest)
	  {
	  xmlHttp=new window.XMLHttpRequest();
	  }
	else // for older IE 5/6
	  {
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlHttp.open("GET",url,false);
	xmlHttp.send(null);
	window.parent.document.getElementById("pageimagegallery").innerHTML=xmlHttp.responseText;
	
}

function showloader() {
	document.getElementById('uploadstatus').innerHTML = '<img src="/images/ajaxloadbluecircle.gif" alt="" width="32" height="32" border="0">';
	return true;
}



// these next functions have to do with showing subquestions on a custom form

function hidesubquestionrow(selID) {
	
	var selObjIDName = 'row' + selID;
	var selObj = document.getElementById(selObjIDName);
	selObj.style.display = "none";

}

function checkforsubquestions(selID,questionID) {
	
	// first find if there is a hidden field saying to show a sub question
	var selObjIDName = 'show_' + selID;
	var selObj = document.getElementById(selObjIDName);
	var shouldweshowvalue = 'yes';
	
	// next get the actual selected item
	var mainquestionobj = document.getElementById(questionID);
	
	// check to see if this is a multi select by splitting the name. if there is a third item in the array
	var mainquestionarr = questionID.split('_');
	if(mainquestionarr.length == 3) {
		
		// which option is selected
		var selectedanswer = mainquestionarr[mainquestionarr.length - 1];
		
		// get yes|no values and choose the one that matches the selected item from parent question
		var valuesIDName = 'values_' + selID;
		var valuesObj = document.getElementById(valuesIDName);
		var valuesObjArr = valuesObj.value.split('|');
		
		shouldweshowvalue = valuesObjArr[selectedanswer];
		
		
	}
	
	// if all conditions are met, show the subquestion
	if(selObj.value > 0 && mainquestionobj.value != '' && shouldweshowvalue == 'yes') {
	
		var rowObjIDName = 'row' + selObj.value;
		
		var rowObj = document.getElementById(rowObjIDName);
		rowObj.style.display = "block";
		rowObj.focus();

	
	}
	
}


function closelargeimage(theLarge) {
	var divlargeimage = document.getElementById("divlargeimage");
	divlargeimage.style.display="none";
	
}

function showlargeimage(theLarge) {
	
	var divlargeimage = document.getElementById("divlargeimage");
	
	divlargeimage.style.display="block";
	
	divlargeimage.innerHTML = "<a href=\"javascript:closelargeimage('divlargeimage');\">Close<br><img src=\""+theLarge+"\" border=\"0\"></a>";
	
}
