/*****************************************General**************************************************/
function over(id){
	id.style.cursor='hand';
}
function winopen(url,w,h){
	window.open(url,"",'width='+ w +',height='+ h +',resizable=yes, scrollbars=no ,status=0 ,toolbar=no ,menubar=no');
}
function trimString (str) {
	str = this != window? this : str;
	return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}   
/*****************************************Home News**************************************************/
function showNews(id){
	for(i=0; i<3; i++){
		document.getElementById('tab_'+i).style.visibility="hidden";
		document.getElementById('news_'+i).style.display="none";
	}
	document.getElementById('tab_'+id).style.visibility="visible";
	document.getElementById('news_'+id).style.display="block";
}

/*****************************************Swap Images***********************************************/
function swapImg(id,tsrc){
	document.getElementById(id).src = tsrc;
}

function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}

function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

/*****************************************Validate Functions***********************************************/

invalidaddress = new Array();
function checkemail(str){
     var invalidcheck=0;
     var filter=/^.+@.+\..{2,3}$/
     if (filter.test(str)){
        var tempstring=str.split("@")
        tempstring=tempstring[1].split(".php ")
        for (i=0;i<invalidaddress.length;i++){
           if (tempstring[0]==invalidaddress[i])
               invalidcheck=1
         }
        if (invalidcheck!=1)
          testresults=true
        else{
            alert("Please ,enter avalid E_mail address")
            testresults=false
             }
      }
    else{
      alert("Please ,enter avalid E-mail address")
      testresults=false
     }
	return (testresults)
}


function validateFields(arr){
	bol=true;
	for (i=0;i<arr.length;i++)    
	if (!arr[i]){ 
		alert("All Feilds Marked with (*) are required ") ;
		bol=false;
		break;
	}
	return bol;
}
/*function validateFields(arr){
  invalidfields=""; bol=true;
  for (i=0;i<arr.length;i++) 
   {   
	   if (arr[i] != null) 
  	     {invalidfields = invalidfields + "  " +arr[i];}
   }
  if( invalidfields != "")
	 {
	  bol=false;
	  alert(" <?=_Required?>::"+invalidfields);
	 }
	 return bol;
  }
 */ 
function validateNum(arr,arr_val){
	bol=true;
	invalidfields='';
	for (i=0;i<arr.length;i++){    
		if ( isNaN(arr[i]) ) {
			invalidfields = invalidfields + "  " +arr_val[i];     
		}
	}
	if( invalidfields != "") {
		  bol=false;
		  alert( "  <?=_Valid_num?> :  " +invalidfields );
	 }
	 return bol; 
	
}
  

