/********************************************************************************************/
/* Web Team 2009 - Vibal Publishing House Inc.												*/ 
/* This code is intended for study purposes.                                                */
/* You may use these functions as you wish, for commercial or non-commercial applications,  */
/* but please note that the author offers no guarantees to their usefulness, suitability or */
/* correctness, and accepts no liability for any losses caused by their use.                */
/********************************************************************************************/


$(document).ready(function(){   
    // for teacher's ichat 
	var show = 0;
	$("#vibal").click(function(){
	    if(show == 1){
			$("#listAll").fadeOut("slow");
			show = 0;
		}else{
			$("#listAll").fadeIn("slow");
			show = 1;
		}		
	}).css({"text-decoration":"underline","cursor":"pointer"});

	
	// INDEX.PHP 
	$("#ilearn").click(function (){ document.location = 'ilearn.php' }).mouseover(function(){ $(this).css({"cursor":"pointer"}) });    
	$("#iteach").click(function (){ document.location = 'iteach.php' }).mouseover(function(){ $(this).css({"cursor":"pointer"}) });    
	$("#iguide").click(function (){ document.location = 'iguide.php' }).mouseover(function(){ $(this).css({"cursor":"pointer"}) });
	
	$("#learn").click(function (){ document.location = 'ilearn.php' }).mouseover(function(){ $(this).css({"cursor":"pointer"}) });    
	$("#teach").click(function (){ document.location = 'iteach.php' }).mouseover(function(){ $(this).css({"cursor":"pointer"}) });    
	$("#guide").click(function (){ document.location = 'iguide.php' }).mouseover(function(){ $(this).css({"cursor":"pointer"}) });
	
	$("#ubd").click(function (){ document.location = 'http://www.vibalpublishing.com/ubd.php' }).mouseover(function(){ $(this).css({"cursor":"pointer"}) });
	$("#sally").click(function (){ document.location = 'http://www.vibalpublishing.com/products.php?m=pv&pid=112' }).mouseover(function(){ $(this).css({"cursor":"pointer"}) });	
	
	$("#ilearn").css({"background":"url(../images/ilearn_tab.png) no-repeat top center"});
	$("#iteach").css({"background":"url(../images/iteach_tab.png) no-repeat top center"});
	$("#iguide").css({"background":"url(../images/iguide_tab.png) no-repeat top center"});	
	$(".features #featured").click(function (){ document.location = 'products.php?m=pv&pid=65' }).mouseover(function(){ $(this).css({"cursor":"pointer"}) });    	
	
	// ABOUT_US.PHP	
	$(".about_us #products").click(function (){ document.location = 'http://vibalpublishing.com/products.php' }).mouseover(function(){ $(this).css({"cursor":"pointer"}) });    		
	$(".topStories1 #wiki").click(function (){ document.location = 'http://en.wikipilipinas.org/index.php?title=Vibal_Publishing_House%2C_Inc.' }).mouseover(function(){ $(this).css({"cursor":"pointer"}) });
	
	//ilearn.php interactive activities
	$("#interactive_act").mouseover(function(){ $(this).css({"cursor":"pointer"}) });
	

	// REGISTER POP-UP
	/*
	$(".reg#register").click(function(){
		$('#reg').dialog('open');			
			return false;
	});*/
	
	// LOGIN POP-UP
	$(".log#login").click(function(){
		$('#log').dialog('open');			
		return false;
	});
	
	$("#act_btn").click(function(){
		$("#act").dialog('open');			
			return false;
	});
	
	$("#ff_up_act_hs_btn").click(function(){
		$("#ff_up_act_hs").dialog('open');			
			return false;
	});
	
	$("#ff_up_act_gs_btn").click(function(){
		$("#ff_up_act_gs").dialog('open');			
			return false;
	});

		//Register Functions
		var fname = $("#fname"),			
			lname = $("#lname"),
			mname = $("#datepicker"),
			gender = $("#gender"),
			email = $("#email"),
			userType = $("userType"),
			subjectArea = $("subjectArea"),
			uname = $("#uname"),
			pass = $("#pass"),
			pass2 = $("#pass2"),
			loc = $("#loc"),
			school = $("#school"),
			schoolCode = $("#schoolCode"),			
			cap = $("#cap"),
			
			allFields = $([]).add(fname).add(lname).add(mname).add(gender).add(email).add(userType).add(subjectArea).add(uname).add(pass).add(pass2).add(loc).add(school).add(schoolCode).add(cap),
			
			
			
			tips = $("#validateTips");
			Apply = $([]).add(fname).add(mname).add(lname);
		
		function updateTips(t) {
			
			tips.text(t).effect("highlight",{},1500);
		}
		
		function checkLength2(o,txt,x,min,max) { 
			if ( o.length > max || o.length < min ) {
				$("#"+x).addClass('ui-state-error');				
				if(x == "position" || x == "bdate" || x == "status"){
					updateTips("You must select your desire "+x+".");
				}else{
					updateTips("Length of " + txt + " must be between "+min+" and "+max+".");
				}	
				return false;				
			} else {
				$("#"+x).removeClass('ui-state-error');	
				return true;
			}				
		}		
		
		function checkRegexp2(o,x,regexp,n) {
			
			if ( !( regexp.test( o ) ) ) {
				$("#"+x).addClass('ui-state-error');
				updateTips(n);				
				return false;
			} else {
				$("#"+x).removeClass('ui-state-error');	
				return true;				
			}		
		}
		
		function checkSch(a,b,c){
			if (a == "(Select your school Here...)") {
				b.addClass('ui-state-error');				
				updateTips(c);
				return false;
			} else {
				return true;
			}
		}
		
		function checkLoc(a,b,c){
			if (a == "(Select Location Here...)") {
				b.addClass('ui-state-error');				
				updateTips(c);
				return false;
			} else {
				return true;
			}
		}
		
		function checkBday(a,b,c){
			if (a == "") {
				b.addClass('ui-state-error');				
				updateTips(c);
				return false;
			} else {
				return true;
			}
		}
		
		function checkSchoolCode(a,b,c){
			if (a == "") {
				b.addClass('ui-state-error');
				updateTips(c);
				return false;
			} else {
				return true;
			}
		}
		
		
		
		function checkPHP(b,c){
			b.addClass();
			updateTips(c);
		}
	$("#Click2Apply").click(function(){			
		$("#CareerDesc").hide("slow");
		$(".CareerAppForm").show("slow");			
	}).mouseover(function(){ $(this).css({"cursor":"pointer"}) });	
	$("#Click2Back").click(function(){			
		$(".CareerAppForm").hide("slow");
		$("#CareerDesc").show("slow");			
	}).mouseover(function(){ $(this).css({"cursor":"pointer"}) });
	
	$(".btn").mouseover(function(){ $(this).css({"cursor":"pointer"}) });
	
	// datepicker
	$(function() {
		$('#datepicker').datepicker({
			dateFormat: 'yy-mm-dd',
			changeMonth: true,
			changeYear: true,
			yearRange: '1980:2009'
		});

	});
	

    // apply 
	
	$("#apply").click(function(){			
		f = document.apply;						
		var bValid = true;			
		Apply.removeClass('ui-state-error');
		
		bValid = bValid && checkLength2(f.fname.value,"First Name","fname",3,16);				
		bValid = bValid && checkRegexp2(f.fname.value,"fname",/^[a-z]([0-9a-z_])+$/i,"First Name may consist of a-z, 0-9, underscores, begin with a letter.");
		bValid = bValid && checkLength2(f.mname.value,"Middle Name","mname",2,16);		
		bValid = bValid && checkRegexp2(f.mname.value,"mname",/^[a-z]([0-9a-z_])+$/i,"Middle Name may consist of a-z, 0-9, underscores, begin with a letter.");
		bValid = bValid && checkLength2(f.lname.value,"Last Name","lname",3,16);			
		bValid = bValid && checkRegexp2(f.lname.value,"lname",/^[a-z]([0-9a-z_])+$/i,"Last Name may consist of a-z, 0-9, underscores, begin with a letter.");				
		bValid = bValid && checkLength2(f.position.value,"Position","position",1,80);				
		bValid = bValid && checkLength2(f.bdate.value,"Birth Date","datepicker",1,10);			
		bValid = bValid && checkLength2(f.status.value,"Status","status",1,80);						
		bValid = bValid && checkLength2(f.email.value,"e-mail","email",1,30);			
		bValid = bValid && checkRegexp2(f.email.value,"email",/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,"eg. inquire@vibalpublishing.com");
		bValid = bValid && checkLength2(f.phone.value,"Phone","phone",7,30);					
		bValid = bValid && checkRegexp2(f.phone.value,"phone",/^([0-9-])+$/i,"Phone number may consist of 0-9, eg. 123-4567.");				
		bValid = bValid && checkLength2(f.mobile.value,"Mobile","mobile",11,30);							
		bValid = bValid && checkRegexp2(f.mobile.value,"mobile",/^([0-9-+])+$/i,"Mobile number may consist of 0-9, eg. +63123456789.");								
		var ext = $('#myFile').val().split('.').pop().toLowerCase();
		var allow = new Array('doc');
		if(jQuery.inArray(ext, allow) == -1) {			
			updateTips("Invalid file extension, eg. 'myfile.doc'");
		}else{
			if(bValid){
				updateTips("Currently sending data. Please wait..");				
				$("#validateTips").hide("fast");
				$("#submit").show("slow");
				for(i=0;i < f.gender.length;i++){
					if(f.gender[i].checked){
						gender = f.gender[i].value
					}
				}
				filename = document.getElementById('myFile').value;					
				applicationSend(f.fname.value,
								f.mname.value,
								f.lname.value,
								f.position.value,
								gender,f.bdate.value,
								f.status.value,
								f.email.value,
								f.phone.value,
								f.mobile.value,
								f.recaptcha_challenge_field.value,
								f.recaptcha_response_field.value,filename);			
			}	
		}
	});
	
	
	/* LOGIN JS */
	$("#log").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 260,
			width: 350,
			maxWidth: 350,
			maxHeight: 260,
			minWidth: 350,
			minHeight: 260,
			modal: true,
			draggable: false,
			buttons: {
				'Log In': function() {
					var login_type = $("#login_type").val();
					var UN = $("#UN").val();
					var PWD = $("#PWD").val();
					
					document.getElementById('error').style.visibility='visible' 						 
					loginResult(login_type,UN,PWD);
					//login_script.php code execute at this line	
				},
				Cancel: function() {
					$(this).dialog('close');
				}
			}
			
	});
	//for ilearn activity list
	$("#act").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 290,
			width: 480,
			maxWidth: 480,
			maxHeight: 290,
			minWidth: 480,
			minHeight: 290,
			modal: true,
			draggable: false,
			buttons: {				
				Close: function() {
					$(this).dialog('close');
				}
			} 
	});
	//for other followup activities
	$("#ff_up_act_hs").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 350,
			width: 500,
			maxWidth: 500,
			maxHeight: 350,
			minWidth: 500,
			minHeight: 350,
			modal: true,
			draggable: false,
			buttons: {				
				Close: function() {
					$(this).dialog('close');
				}
			}
	});
	
	$("#ff_up_act_gs").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 275,
			width: 500,
			maxWidth: 500,
			maxHeight: 275,
			minWidth: 500,
			minHeight: 275,
			modal: true,
			draggable: false,
			buttons: {				
				Close: function() {
					$(this).dialog('close');
				}
			} 
	});
	
	$("#Inquiry").click(function (){ document.location.href = 'http://www.vibalpublishing.com/news.php?m=nv&nid=42' }).mouseover(function(){ $(this).css({"cursor":"pointer"}) });    				
	
	$("#feed_me").click(function(){  				
	
	    regexp = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
		$("#validateTips").css({"color":"maroon","text-indent":"115px"});
		$(".feedback").css({"height":"350px"});
		$(".feedback form").css({"height":"350px"});
		if(!document.feeds.name.value){								
			$("#validateTips").show("slow");
			tips.text("** Enter your name **").effect("highlight",{},1500);		
			$("#name").addClass('ui-state-error');		
			$("#submit").hide("slow");
		}else{
		    $("#name").removeClass('ui-state-error');
			if(!document.feeds.mail.value || !regexp.test( document.feeds.mail.value )){		
				$("#validateTips").show("slow");
				tips.text("** Enter your e-mail address **").effect("highlight",{},1500);		
				$("#mail").addClass('ui-state-error');
				$("#submit").hide("slow");
			}else{
				$("#mail").removeClass('ui-state-error');
				if(!document.feeds.school.value){		
					$("#validateTips").show("slow");
					tips.text("** Enter your school name **").effect("highlight",{},1500);		
					$("#school").addClass('ui-state-error');
					$("#submit").hide("slow");
				}else{
					$("#school").removeClass('ui-state-error');
					if(!document.feeds.message.value){					    
						$("#validateTips").show("slow");
						tips.text("** Enter your message **").effect("highlight",{},1500);		
						$("#message").addClass('ui-state-error');
						$("#submit").hide("slow");	
					}else{
						$("#message").removeClass('ui-state-error');
						$("#validateTips").hide("slow");
						$("#submit").show("slow");
						return true;
					
					// submit...
					//alert(document.feeds.name.value+" "+document.feeds.mail.value+" "+document.feeds.message.value);	
                    /*feedbackSend(document.feeds.name.value,
								 document.feeds.mail.value,
								 document.feeds.message.value,
								 document.feeds.recaptcha_challenge_field.value,
								 document.feeds.recaptcha_response_field.value); 					
								 */
					}				
				}			
				
			}			
		}			
	});
	
	

	//end 	
	
	// END
});


//function for retrieving a cookie value
function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
			for(var i=0;i < ca.length;i++) {
				var c = ca[i];
				while (c.charAt(0)==' ') c = c.substring(1,c.length);
				if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
			}
		return null;
} 

var xmlhttp;

// livesearch check
function showResult(str)
{

	if (str.length==0){
	  document.getElementById("livesearch").innerHTML="";
	  document.getElementById("livesearch").style.border="0px";
	  return;
	}
	xmlhttp=GetXmlHttpObject()
	if (xmlhttp==null){
		alert ("Your browser does not support XML HTTP Request");
		return;
	}
	  
	var url="livesearch.php";
	url=url+"?q="+str;
	url=url+"&sid="+Math.random();
	xmlhttp.onreadystatechange=stateChanged ;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
	function stateChanged()
	{
		if (xmlhttp.readyState==4)
		  {
		  document.getElementById("livesearch").innerHTML=xmlhttp.responseText;
		  }
	}
}
//end of livesearch check

// Register Live Check. Orayt!

function registerResult(fname,lname,mname,gender,email,userType,subjectArea,uname,pass,pass2,schoolCode,loc,school,chal,resp){

	xmlhttp=GetXmlHttpObject()
	if (xmlhttp==null){
	  alert ("Your browser does not support XML HTTP Request");
	  return;
	}

	var url="register_script.php";
	var params="fname="+fname+"&lname="+lname+"&bday="+mname+"&gender="+gender+"&email="+email+"&userType="+userType+"&subjectArea="+subjectArea+"&uname="+uname+"&pass="+pass+"&pass2="+pass2+"&schoolCode="+schoolCode+"&loc="+loc+"&school="+school+"&schoolCode="+schoolCode+"&email="+email+"&chal="+chal+"&resp="+resp;

	xmlhttp.onreadystatechange=stateChanged2;
	xmlhttp.open("POST",url,true);
	
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", params.length);
	xmlhttp.setRequestHeader("Connection", "close");
	
	xmlhttp.send(params);
	
	function stateChanged2()
	{
		if (xmlhttp.readyState==4)
		  {
		  document.getElementById("errorREG").innerHTML=xmlhttp.responseText;
		  
		  }
	}
}

//end

//activity 
function flash(filename,height,width){	
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
		alert ("Your browser does not support XMLHTTP!");
		return;
	}
	var url="swf.php";
	url=url+"?file="+filename+"&height="+height+"&width="+width;
	url=url+"&sid="+Math.random();
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);

	function stateChanged()
	{
		if (xmlhttp.readyState==4){
				document.getElementById("FL").innerHTML=xmlhttp.responseText;
		}
	}
}



// LOGIN
function loginResult(login_type,UN,PWD){

	xmlhttp=GetXmlHttpObject()
	if (xmlhttp==null){
	  alert ("Your browser does not support XML HTTP Request");
	  return;
	}

	var url="login_script.php";
	url=url+"?login_type="+login_type+"&name="+UN+"&pass="+PWD;
	url=url+"&sid="+Math.random();
	xmlhttp.onreadystatechange=stateChanged2;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
	function stateChanged2()
	{
		if (xmlhttp.readyState==4)
		  {
			document.getElementById("error").innerHTML=xmlhttp.responseText;
			
			/*for login redirection*/
			if (xmlhttp.responseText != "<p><img src='/images/close.png'/>&nbsp;&nbsp;Password does not Match</p>" &&
				xmlhttp.responseText != "<p><img src='/images/close.png'/>&nbsp;&nbsp;Username does not Match</p>" &&
				xmlhttp.responseText != "<p><img src='/images/info.png' height=15px width=15px />&nbsp;&nbsp;Please fill up all the required fields.</p>"){
				
				if (login_type == "Vibal"){
					window.location = "url_redirect.php";
				}else if (login_type == "Teacher"){
					window.location = "iteach_user.php";
				}
				
			}
			/*end of login redirection*/
		  }
	}
}

// end

//feedback sending...
function feedbackSend(a,b,c,d,e){    

	xmlhttp=GetXmlHttpObject()
	if (xmlhttp==null){
	  alert ("Your browser does not support XML HTTP Request");
	  return;
	}
	var url="feedback.php";
	var params="a="+a+"&b="+b+"&c="+c+"&d="+d+"&e="+e;

	xmlhttp.onreadystatechange=stateChanged3;
	xmlhttp.open("POST",url,true);
	
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", params.length);
	xmlhttp.setRequestHeader("Connection", "close");
	
	xmlhttp.send(params);	
	
	function stateChanged3()
	{
		if (xmlhttp.readyState==4)
		  {
			document.getElementById("submit").innerHTML=xmlhttp.responseText;
		  }
	}
}

function applicationSend(a,b,c,d,e,f,g,h,i,j,k,l,m){

	xmlhttp=GetXmlHttpObject()
	if (xmlhttp==null){
	  alert ("Your browser does not support XML HTTP Request");
	  return;
	}
	var url="resume.php";
	var params="a="+a+"&b="+b+"&c="+c+"&d="+d+"&e="+e+"&f="+f+"&g="+g+"&h="+h+"&i="+i+"&j="+j+"&k="+k+"&l="+l+"&m="+m;		

	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("POST",url,true);
	
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", params.length);
	xmlhttp.setRequestHeader("Connection", "close");
	
	xmlhttp.send(params);	
	
	function stateChanged()
	{
		if (xmlhttp.readyState==4)
		  {
			document.getElementById("submit").innerHTML=xmlhttp.responseText;
		  }
	}
}

function schools_list(str) {
		
	if (str.length==0){
	  document.getElementById("validateEMAIL").innerHTML="";
	  document.getElementById("validateEMAIL").style.border="0px";
	  return;
	}
	xmlhttp=GetXmlHttpObject()
	if (xmlhttp==null){
		alert ("Your browser does not support XML HTTP Request");
		return;
	}
	
	var url="schools_list.php";
	url=url+"?q="+str;
	url=url+"&sid="+Math.random();
	xmlhttp.onreadystatechange=stateChanged ;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
	function stateChanged()
	{
		if (xmlhttp.readyState==4)
		  {
		  document.getElementById("school_loc_name").innerHTML=xmlhttp.responseText;
		  
			  if (xmlhttp.responseText == "<center><img src='images/loading_icon.gif' border='0' height='42' width='149'/></center>"){
				document.getElementById("loading").innerHTML="<img src='/images/close.png' />";
			  }else{
				document.getElementById("loading").innerHTML="<img src='/images/check.png' />";
			  }
		  
		  }
	}
}
//end of main functions
function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}
// end


