// JavaScript Document
function set_tab_class(div_nm,clasnm){
	document.getElementById(div_nm).className = clasnm;
}

function expand(s, aclink, acclass){
  var td = s;
  var d = td.getElementsByTagName("div").item(0);
  if (d){
  td.className = "menuHover";
  d.className = "menuHover";
  }
  //alert(aclink);
  document.getElementById(aclink).className = acclass;
}

function collapse(s, aclink, acclass){
  var td = s;
  var d = td.getElementsByTagName("div").item(0);
  if (d){
  td.className = "menuNormal";
  d.className = "menuNormal";
  }
  document.getElementById(aclink).className = acclass;
}

function open_popup_page(pageid){
	 var url = 'popuppage.php?id='+pageid;
	 var ttl = 'Popup';
	 var params = 'status=yes, resizable=yes ,width=700px, height=600px, top=10px, left=10px, scrollbars=yes, resizable';
	 window.open(url, ttl, params);
}

function popitup(url) {
  newwindow=window.open(url,'name','height=230,width=350,scrollbars=no');
  if (window.focus) {newwindow.focus()}
  return false;
}

function check_down(){
 if (document.down_ff.sc.checked){
   return true
 }else{
   alert ("Please check the Successful field")
   return false
 }
 
}

function top_menu(m_imgid, m_imgnm, foldoption){  
  document.images[m_imgid].src = foldoption + "images/" + m_imgnm;
}

function news_check(){
	 
	 if(!validate_text(document.news_ff.fname,1,"Please enter your First Name")){
	    return false;
	 }
	 
	 if(!validate_text(document.news_ff.lname,1,"Please enter your Last Name")){
	    return false;
	 }
	 
	 if(!validate_email(document.news_ff.email,1,"Please enter your Email Address")){
	    return false;
	 }
	 
	 if(!validate_email(document.news_ff.re_email,1,"Please Confirm your Email")){
			 return false;
	 } 
	   
	 if (document.news_ff.email.value != document.news_ff.re_email.value){
		  alert ("Please enter your Email correctly");
		  document.news_ff.email.value = "";
		  document.news_ff.re_email.value = "";
		  document.news_ff.email.focus();
		  return false;
	 }
	 
	 if(!validate_text(document.news_ff.zip,1,"Please enter your ZipCode")){
	    return false;
	 } 
	 
	 if (document.news_ff.over14.checked == false){
		  alert ("Please certify that you are over 14 years of age");
		  return false;
	 }
	 
	 if(!validate_text(document.news_ff.captcha,1,"Please enter Validation String")){
	    return false;
	 }
	
     return true;
}

function con_check(){
	if(!validate_text(document.con_ff.name,1,"Please enter your Name")){
	   return false;
	}
	
	if(!validate_email(document.con_ff.email,1,"Please enter your Email")){
	   return false;
	}
	
	return true;
}

var liveReqp ="";
function getdata(aa,tb,fld,folpth) {			
	chng = fld;
	
	if (window.XMLHttpRequest) {
		liveReqp = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		liveReqp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	var sURL = folpth + "includes/get_cat.php?id="+aa+"&tbl="+tb;
	liveReqp.onreadystatechange = receivercode;
	liveReqp.open("GET", sURL);		
	liveReqp.send(null);
}

function receivercode(){
   if (liveReqp.readyState == 4) {
          
       var nummd =  document.getElementById(chng).length;	   
	   while(nummd > 1) {
		   nummd--;
		   document.getElementById(chng).options[nummd] = null;
	   }				    
	    
		var str=liveReqp.responseText;			
		var str_sr=str.split("#");
		var str_ln=str_sr.length
	
	    for (var k=0;k<str_ln-1;k++){
			 var second_sr=str_sr[k].split("/!");
			 document.getElementById(chng).options[k+1] = new Option(second_sr[0], second_sr[1]);
	    }
	}
 }

