function MembersLogin(frm){
	
	alert("Members Login are currently restricted");
	
}

function MemberRego(){
	
	var frm  = document.registration;
	
	
	
	var minimumlength = 6;
	var maximumlength = 25;	
	
	// CHECK ACCOUNT DETAILS
	
	if ( frm.username.value.length < minimumlength || frm.username.value.length > maximumlength ) {
		alert("Your Username Must Contain Between " + minimumlength + " and " + maximumlength + " Characters");
		return false;
	}
	
	if( frm.username.value == "" ){
		alert("Your Username Cannot Be Blank");
		return false;
	}
	
	if ( frm.password.value.length < minimumlength || frm.password.value.length > maximumlength )  {
		alert("Your Password Must Contain Between " + minimumlength + " and " + maximumlength + " Characters");
		return false;
	}

	if ( frm.passwordconfirm.value.length < minimumlength || frm.passwordconfirm.value.length > maximumlength )  {
		alert("Your Password Confirmation Must Contain Between" + minimumlength + " and " + maximumlength + " Characters");
		return false;
	}
	
	if ( frm.password.value != frm.passwordconfirm.value ){
		alert("Your confirmation password does not match, please re-type and try again!");
		return false;
	}
	
	if ( frm.password.value == frm.username.value ) {
		alert("Password can not Contain Username characters");
		return false;
		
	}
	

	// CHECK STANDARD INFORMATION
	
	if ( !ValidEmailAddress( frm.email.value ) ) {
			alert("Sorry, but this does not appear to be a valid Email Address");
			return false;
	}
	alert("A");
/*		
	if ( !ValidEmailAddress( frm.emailconfirm.value ) ) {
		alert("Sorry, but Your Email Confirmation does not appear to be a valid Email Address");
		return false;
	}
		
	if ( frm.email.value != frm.emailconfirm.value ){
		alert("Your confirmation Email does not match, please re-type and try again!");
		return false;
	}

		

		
	// CHECK ZONE INFORMATION	

	if ( !ValidUZNCharacters( frm.uzn.value ) ){
		alert("Your UZN must be in lower case and can be a combination of letters and numbers \neg. abcsite123.\n\n No special characters like \"%-@_# or spaces allowed!");
		return false;
	}
	
	if ( frm.uzn.value.length < minimumlength || frm.uzn.value.length > maximumlength )  {
		alert("Your UZN Must Contain Between " + minimumlength + " and " + maximumlength + " Characters");
		return false;
	}
	
	if ( frm.header.value == "" ){
		alert("You Must Give your Website a Name");
		frm.header.focus();
		return false;
	}

	
*/
	
	// CHECK PERSONAL INFORMATION
	
	if( frm.firstname.value == "" ){
		alert("Please complete your First Name");
		return false;
	}
	
	if( frm.lastname.value == "" ){
		alert("Please complete your Last Name");
		return false;
	}
	
	if( frm.city.value == "" ){
		alert("Please provide your City");
		return false;
	}
	

	
	// CHECK REGERAL INFORMATION
	
	if( frm.country_name.value == 0 ){
		alert("Please Select your Country");
		return false;
	}
	
	if( frm.country_name.value == 0 ){
		alert("Please Select your Country");
		return false;
	}
	
	/*

	// CHECK TERMS AND CONDITIOSN
	
		if ( frm.terms.checked != true ){
			alert("You Must agree to the Terms and Conditions");
			return false;
		}
		
	// CHECK VERIFICATION
		if ( frm.securitycode.value == "" ){
			alert("You Must complete the Form Verification");
			return false;
		}	
	*/
	
	frm.action="?mod=register&action=new";
	frm.submit();	
	
}


function ChangeMyZone( url, zone ) {
	
	window.location.href = url + "?zone=" + zone;
}

function changePage( action, page, query, string, value ){

	var url = "";
	page--;
	
	if ( query != "" ) {
		url = "?action="+action+"&page="+page+"&"+q+"="+s;
	}
	else{
		url = "?action="+action+"&page="+page;
	}
	window.location.href = url;
}

function redirect( url ){
		window.location.href = url;
}

function Trim(strInput) {
	return strInput.replace(/\s/g, '');
}

function PhotoViewer( popupLocation, id  ){
	
		popupLocation = "http://" + document.domain + "/model/multimedia/image/view.php" + "?id=" + id;
		var popupWidth = 1080;
		var popupHeight = 850;
		var statusBarOn = true;
	
		var heightspeed = 20; 	// vertical speed
		var widthspeed 	= 20;  	// horizontal speed
		var leftdist 	= (screen.width - popupWidth) / 2;    	// distance to left edge of window
		var topdist 	= (screen.height - popupHeight) / 2;   	// distance to top edge of window
		if (document.all)
		{
			if (statusBarOn) 
			{
				var popup = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=4,height=4,scrollbars=yes,resizable=yes,status=yes");
			} 
			else
			{ 
				var popup = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=4,height=4,scrollbars=yes,resizable=yes,status=yes");
			}
	
			for (sizeheight = 1; sizeheight < popupHeight; sizeheight += heightspeed) 
			{
				popup.resizeTo("1", sizeheight);
			}
			for (sizewidth = 1; sizewidth < popupWidth; sizewidth += widthspeed) 
			{
				popup.resizeTo(sizewidth, sizeheight);
			}
			
			popup.resizeTo(popupWidth, popupHeight);
			popup.location = popupLocation;
		}
		else
		{
			var popup = window.open(popupLocation,"","left=" + leftdist + ",top=" + topdist + ",width=" + popupWidth + ",height=" + popupHeight + ",scrollbars=yes");
		}
	
}

function PopUp( popupLocation  ){
	
		var popupWidth = 1200;
		var popupHeight = 950;
		var statusBarOn = true;
	
		var heightspeed = 20; 	// vertical speed
		var widthspeed 	= 20;  	// horizontal speed
		var leftdist 	= (screen.width - popupWidth) / 2;    	// distance to left edge of window
		var topdist 	= (screen.height - popupHeight) / 2;   	// distance to top edge of window
		if (document.all)
		{
			if (statusBarOn) 
			{
				var popup = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=4,height=4,scrollbars=yes,resizable=yes,status=yes");
			} 
			else
			{ 
				var popup = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=4,height=4,scrollbars=yes,resizable=yes,status=yes");
			}
	
			for (sizeheight = 1; sizeheight < popupHeight; sizeheight += heightspeed) 
			{
				popup.resizeTo("1", sizeheight);
			}
			for (sizewidth = 1; sizewidth < popupWidth; sizewidth += widthspeed) 
			{
				popup.resizeTo(sizewidth, sizeheight);
			}
			
			popup.resizeTo(popupWidth, popupHeight);
			popup.location = popupLocation;
		}
		else
		{
			var popup = window.open(popupLocation,"","left=" + leftdist + ",top=" + topdist + ",width=" + popupWidth + ",height=" + popupHeight + ",scrollbars=yes");
		}
	
}


function Selector( file, type, field ){
		
	
		var popupWidth = 1040;
		var popupHeight = 800;
		var statusBarOn = true;
	
		var heightspeed = 20; 	// vertical speed
		var widthspeed 	= 20;  	// horizontal speed
		var leftdist 	= (screen.width - popupWidth) / 2;    	// distance to left edge of window
		var topdist 	= (screen.height - popupHeight) / 2;   	// distance to top edge of window
		if (document.all)
		{
			if (statusBarOn) 
			{
				var popup = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=4,height=4,scrollbars=yes,resizable=yes,status=yes");
			} 
			else
			{ 
				var popup = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=4,height=4,scrollbars=yes,resizable=yes,status=yes");
			}
	
			for (sizeheight = 1; sizeheight < popupHeight; sizeheight += heightspeed) 
			{
				popup.resizeTo("1", sizeheight);
			}
			for (sizewidth = 1; sizewidth < popupWidth; sizewidth += widthspeed) 
			{
				popup.resizeTo(sizewidth, sizeheight);
			}
			
			popup.resizeTo(popupWidth, popupHeight);
			popup.location = file + "?action=" + type + "&field=" + field;
		}
		else
		{

			var popup = window.open(file + "?action=" + type + "&field=" + field,"","left=" + leftdist + ",top=" + topdist + ",width=" + popupWidth + ",height=" + popupHeight + ",scrollbars=yes");
		}
}

function DatePicker( calendar, field ){
		
		var popupWidth = 400;
		var popupHeight = 400;
		var statusBarOn = true;
	
		var heightspeed = 20; 	// vertical speed
		var widthspeed 	= 20;  	// horizontal speed
		var leftdist 	= (screen.width - popupWidth) / 2;    	// distance to left edge of window
		var topdist 	= (screen.height - popupHeight) / 2;   	// distance to top edge of window
		if (document.all)
		{
			if (statusBarOn) 
			{
				var popup = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=4,height=4,scrollbars=yes,resizable=yes,status=yes");
			} 
			else
			{ 
				var popup = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=4,height=4,scrollbars=yes,resizable=yes,status=yes");
			}
	
			for (sizeheight = 1; sizeheight < popupHeight; sizeheight += heightspeed) 
			{
				popup.resizeTo("1", sizeheight);
			}
			for (sizewidth = 1; sizewidth < popupWidth; sizewidth += widthspeed) 
			{
				popup.resizeTo(sizewidth, sizeheight);
			}
			
			popup.resizeTo(popupWidth, popupHeight);
			popup.location = calendar + "?field=" + field;
		}
		else
		{
			var popup = window.open(calendar + "?field=" + field,"","left=" + leftdist + ",top=" + topdist + ",width=" + popupWidth + ",height=" + popupHeight + ",scrollbars=yes");
		}
}

function returnDate(date, field){

	if (window.opener && !window.opener.closed) {
		
    	window.opener.insertDate(date, field);
	}
    
	window.close();
}


function ChangeMonth(year, field) {

	var frm = document.calendar;
	changeMonth = frm.month.value;

	window.location.href = "calendar.php?month=" + changeMonth + "&year=" + year + "&field=" +field;

}

function Month(month, year, field ){

	if ( month < 1 ) {
		window.location.href = "calendar.php?month=" + 12 + "&year=" + (year-1) + "&field=" +field;
	}
	else if ( month > 12 ) {
		window.location.href = "calendar.php?month=" + 1 + "&year=" + (year+1) + "&field=" +field;
	}
	else {
		window.location.href = "calendar.php?month=" + month + "&year=" + year + "&field=" +field;
	}

	
}

function ChangeYear( month, field ) {
	var frm = document.calendar;
	window.location.href = "calendar.php?month=" + month + "&year=" + frm.year.value + "&field=" +field;
}

function Help( topic  ){
	
		popupLocation = "http://" + document.domain + "/help/" + "?topic="+ topic;
		
		var popupWidth = 1050;
		var popupHeight = 750;
		var statusBarOn = true;
	
		var heightspeed = 20; 	// vertical speed
		var widthspeed 	= 20;  	// horizontal speed
		var leftdist 	= (screen.width - popupWidth) / 2;    	// distance to left edge of window
		var topdist 	= (screen.height - popupHeight) / 2;   	// distance to top edge of window
		if (document.all)
		{
			if (statusBarOn) 
			{
				var popup = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=4,height=4,scrollbars=yes,resizable=yes,status=yes");
			} 
			else
			{ 
				var popup = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=4,height=4,scrollbars=yes,resizable=yes,status=yes");
			}
	
			for (sizeheight = 1; sizeheight < popupHeight; sizeheight += heightspeed) 
			{
				popup.resizeTo("1", sizeheight);
			}
			for (sizewidth = 1; sizewidth < popupWidth; sizewidth += widthspeed) 
			{
				popup.resizeTo(sizewidth, sizeheight);
			}
			
			popup.resizeTo(popupWidth, popupHeight);
			popup.location = popupLocation;
		}
		else
		{
			var popup = window.open(popupLocation,"","left=" + leftdist + ",top=" + topdist + ",width=" + popupWidth + ",height=" + popupHeight + ",scrollbars=yes");
		}
	
}

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}


function LoadContent( content, id ){

	
	var url = "";
	xmlHttp=GetXmlHttpObject();

	switch( content ) {

		case "edit":
			url = "_inc/_ajax_edit.php";
			break;

		case "view":
		default:
			url = "_inc/_ajax_view.php";
			break;
			
			alert( url );

	}	

	if (xmlHttp==null)  {
		alert ("Your browser does not support AJAX!");
		return;
	}
			

	url=url+"?id="+id;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange = stateObject;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


/* DO NOT EDIT BELOW */
function doSearch( value ){	
	
	showHint(value);
}


function xdoSearch( ){
	
	var frm = document.ezyzonesearchform;

	if ( frm.ezywords.value== "" ) {
		return false;
	}
	frm.action="?mod=ezysearch";
	frm.submit();
	
}

var xmlHttp;

function showHint(str) {
		
	//alert(str);
	if (str.length==0) {
		document.getElementById("ajaxwindow").innerHTML="";
		return;
	}
	
	var frm = document.ezyzonesearchform;
	
	var queryString = "";//&field=lastname";
	
	
	var searchfieldChecked;
	var i=0
		for (i = 0; i < frm.ezyzone.length; i++) {
			
			if (frm.ezyzone[i].checked) {
			searchfieldChecked = frm.ezyzone[i].value;
			}
		}
	
	if(searchfieldChecked) { //if(searchfieldCheck) is just saying, "if searchfieldChecked does not equal null"
		queryString = "&field="+searchfieldChecked;//alert("Search By: " + searchfieldChecked);
	}
	

	xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null)  {
		alert ("Your browser does not support AJAX!");
		return;
	} 

	var url= "http://"+document.domain+"/search.php"//gethint.php";
	url=url+"?q="+str;
	url=url+"&sid="+Math.random();
	url=url+"&field="+queryString;
	
	//alert( url );
	
	xmlHttp.onreadystatechange=stateSearch;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

// For Search Results 
function stateSearch() { 
	if (xmlHttp.readyState==4) {
		document.getElementById("ajaxwindow").innerHTML=xmlHttp.responseText;
	}
}

// For Object Page
function stateObject() { 
	if (xmlHttp.readyState==4) {
		document.getElementById("ajaxwindow").innerHTML=xmlHttp.responseText;
	}
}

function GetXmlHttpObject() {
	var xmlHttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}

	return xmlHttp;
}

