/* *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
/* Common.js                                                                          */
/* Common javascript effect                                                           */
/* *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */


/* *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */

function setallTable(){	
	var tableEle=document.getElementsByTagName('table');	
	for(var i=0; i<tableEle.length;i++){
		tableEle[i].cellPadding=0;
		tableEle[i].cellspacing=0;	
	}
}
setallTable;

/* *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */

function setStatu(statu){
	window.status=statu;		
}
setStatu(" Welcome to asiancupids.com!");

/* *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
function ResumeError() { 
return true; 
} 
window.onerror = ResumeError;

/* *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */

function ShowDate(){
var date=new Date();
var month=date.getMonth();
var datenow=date.getDate();
var year=date.getFullYear();
//var arr=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var arr = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
var str=arr[month]+" "+datenow+", "+year;
document.write(str);
}

function ShowDateTime(){
	var date=new Date();
	var month=date.getMonth()+1;
	var datenow=date.getDate();
	var year=date.getFullYear(); 	
	var datearr=new Array("Sunday","Monday","Tuesday","Wednesday","Friday","Saturday");
	var day=datearr[date.getDay()-1];
	var hor=date.getHours();	
	var statu=hor>12?"pm":"am";
	var	miu = date.getMinutes() ;
	miu=miu<10?"0"+miu:miu;	
	var arr=new Array("January","February","March","April","May","June","July","August","September","October","November","December"		);
	var str=day+", "+arr[month]+" "+datenow+", "+year+" | "+ showTheHours(hor)+"."+ miu +" "+statu;	
	document.write(str);
	
	function showTheHours(theHour)
	{
    if (theHour > 0 && theHour < 13)
    {
        if (theHour == "0") theHour = 12;
        return (theHour);
    }
    if (theHour == 0)
    {
        return (12);
    }
    return (theHour-12);
	}
	
}

/* *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
function BottomLink(){
    document.write("<a href='FindyourCupid.aspx?mysex=2&needsex=2&Country=Thailand'>Dating, Personals and Cupids in Thailand</a> | ");
    document.write("<a href='FindyourCupid.aspx?mysex=2&needsex=2&Country=Philippines'>Dating, Personals and Cupids in Philippines</a> | ");
    document.write("<a href='FindyourCupid.aspx?mysex=2&needsex=2&Country=Indonesia'>Dating, Personals and Cupids in Indonesia</a> | ");
    document.write("<a href='FindyourCupid.aspx?mysex=2&needsex=2&Country=Laos'>Dating, Personals and Cupids in Laos</a> | ");
    document.write("<a href='FindyourCupid.aspx?mysex=2&needsex=2&Country=Japan'>Dating, Personals and Cupids in Japan</a> | ");
    document.write("<a href='FindyourCupid.aspx?mysex=2&needsex=2&Country=Hong Kong'>Dating, Personals and Cupids in Hong Kong</a> | ");
    document.write("<a href='FindyourCupid.aspx?mysex=2&needsex=2&Country=Malaysia'>Dating, Personals and Cupids in Malaysia</a> | ");
    document.write("<a href='FindyourCupid.aspx?mysex=2&needsex=2&Country=Cambodia'>Dating, Personals and Cupids in Cambodia</a> | ");
    document.write("<a href='FindyourCupid.aspx?mysex=2&needsex=2&Country=Korea'>Dating, Personals and Cupids in Korea</a> | ");
    document.write("<a href='FindyourCupid.aspx?mysex=2&needsex=2&Country=China'>Dating, Personals and Cupids in China</a> | ");
    document.write("<a href='FindyourCupid.aspx?mysex=2&needsex=2&Country=Singapore'>Dating, Personals and Cupids in Singapore</a> | ");
    document.write("<a href='FindyourCupid.aspx?mysex=2&needsex=2&Country=Taiwan'>Dating, Personals and Cupids in Taiwan</a>  | ");
    document.write("<a href='FindyourCupid.aspx?mysex=2&needsex=2&Country=Vietnam'>Dating, Personals and Cupids in Vietnam</a>  ");

}
/* *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
function QucikLink(){
    document.write('<a href="ContactUs.aspx">Contact Us</a> | ');
    document.write('<a href="AsianCupid.aspx?ID=2">Terms of Use</a> | ');
    document.write('<a href="AsianCupid.aspx?ID=3">Privacy Policy</a> | ');
    document.write('<a href="TopGirls.aspx">Girls by Top Cities</a> | ');
    document.write('<a href="TopBoys.aspx">Boys by Top Cities</a>');
}

/* *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */

function ChangeImg(){  
var how_many_ads = 3 ;
var now = new Date() ;
var sec = now.getSeconds() ;
var ad = sec % how_many_ads; 
ad+=1;
var img=document.getElementById("mainImg");
changeAd(ad);
	function changeAd(i){		
		img.src="images/maingirl"+i+".jpg";		
	}
}

/* *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
function EditTextarea(id){
	var obj=document.getElementById(id); 	
	var alltext=obj.getElementsByTagName("textarea");	
	 alltext[0].style.color="#9d726f";  
	alltext[0].onfocus=function(){                 
                    if(this.s==undefined){ 
                        this.style.color="#000";                                      
                        this.value="";
                        this.s=1;                          
                	}                    
	}
}


function EditLoginBox(id){
     var obj=document.getElementById(id);
     var alltext=obj.getElementsByTagName("input");    
     for(var i=0;i<alltext.length;i++){ 
        if(alltext[i].type=="text"){
            alltext[i].style.color="#9d726f";
            alltext[i].onfocus=function(){ 
                if(this.s==undefined){   
                     this.style.color="#000";                              
                     this.value="";
                     this.s=1;  
                }
               
            }
         }
      }
}
function EditInput(id){
      var obj=document.getElementById(id); 
      var alltext=obj.getElementsByTagName("input");
     
      
      var temp = document.getElementById("uploadbox")
      //temp1 = temp.getElementsByTagName("input");
      
     
        
      var alltextarea=obj.getElementsByTagName("textarea");    
      
     for(var j=0;j<alltextarea.length;j++){  
                alltextarea[j].style.color="#9d726f";                        
                alltextarea[j].onfocus=function(){                 
                    if(this.s==undefined){ 
                        this.style.color="#000";                                      
                        this.value="";
                        this.s=1;                          
                }                    
           }           
      }
      
      for(var i=0;i<alltext.length;i++){  
        if(alltext[i].type=="text"){           
            alltext[i].style.color="#9d726f";
            alltext[i].onfocus=function(){ 
                if(this.s==undefined){   
                     this.style.color="#000";                              
                     this.value="";
                     this.s=1;  
                }
               
            }
         }
      }
}

/* *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */

var writeNav=function(){
document.writeln('<a href="onlinemem.html">VIEW MEMBERS ONLINE</a> | <a href="createprofile.html">SIGN UP</a> | <a href="#">BOOKMARK US</a> | January 25, 2008 - 3,645 members online now')	;
}


/* *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */

function onEnter(field,text){
    if(field.value == text){
        field.value = "";
    }
}
function onExit(field,text){
    if(field.value == ""){
        field.value=text;
    }
}

/*--Get Word Sum----------------------------------*/
function GetWordSum(myword){
     var re=/\b[a-zA-Z\-]+\b/g;
     var sum=myword.match(re).length;      
     return sum;   
}


/*---------------------------*/
 function GetQueryString(item){ 
var sValue=location.search.match(new RegExp("[\?\&]"+item+"=([^\&]*)(\&?)","i")) 
return sValue?sValue[1]:sValue 
} 

/*---------------------------*/
function GetWordLength(myvalue){
    var re=/\b[a-zA-Z\-]+\b/g;                 
    return myvalue.match(re).length;
}

