var win=null;function NewWindow(mypage,myname,w,h,scroll){LeftPosition=(screen.width)?(screen.width-w)/2:0;TopPosition=(screen.height)?(screen.height-h)/2:0;settings='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';win=window.open(mypage,myname,settings);}
function click_count(id_,url_topass,img_id){var id_set=id_;var url_set=url_topass;var img_set=img_id;var ajaxRequest;try{ajaxRequest=new XMLHttpRequest();}catch(e){try{ajaxRequest=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{ajaxRequest=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){alert("Your browser broke!");return false;}}}
ajaxRequest.onreadystatechange=function(){if(ajaxRequest.readyState==4){document.getElementById(img_set).innerHTML=ajaxRequest.responseText;NewWindow(url_topass,'','900','800','yes');}}
var answer=confirm('do you want to read the full story? Note: please allow pop up window..');if(answer)
{var gdata="http://www.trip-to-hongkong.com/wp-content/themes/trip-to-hongkong/rating_control_id.php?id_read="+id_set+"&cap=count_read";ajaxRequest.open("GET",gdata,true);ajaxRequest.send(null);}}
function textCounter(id){var rc_comment=document.getElementById('com_text'+id);var lbl_comm_count=document.getElementById('lblcount'+id);var maxlimit=300;if(rc_comment.value.length>maxlimit){rc_comment.value=rc_comment.value.substring(0,maxlimit);}else{lbl_comm_count.innerHTML=(maxlimit-rc_comment.value.length)+' characters left';}}
function AddToFavorites(url,title)
{if(window.sidebar)
window.sidebar.addPanel(title,url,'');else if(window.opera&&window.print)
{var elem=document.createElement('a');elem.setAttribute('href',url);elem.setAttribute('title',title);elem.setAttribute('rel','sidebar');elem.click();}
else if(document.all)
window.external.AddFavorite(url,title);}
function validAll(linkid,sitename,ratername,remail,ratep,com_text,com_form){var l=linkid;var s=sitename;var r=ratername;var re=remail;var rp=ratep;var com=com_text;var com_f=com_form;if(!isValidEmail(document.getElementById(re).value)){alert("please input a valid email");document.getElementById(re).style.background='#EDFCCC';document.getElementById(re).focus()}
else if(document.getElementById(r).value.length<=0){alert("no name");document.getElementById(r).style.background='#EDFCCC';document.getElementById(r).focus()}else{rateit(l,s,r,re,rp,com,com_f);}}
function isValidEmail(str){return(str.indexOf(".")>2)&&(str.indexOf("@")>0);}
function rateit(linkid,linkname,rname,remail,ratep,com,com_f){var com_f=com_f;var ajaxRequest;try{ajaxRequest=new XMLHttpRequest();}catch(e){try{ajaxRequest=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{ajaxRequest=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){alert("Your browser broke!");return false;}}}
ajaxRequest.onreadystatechange=function(){if(ajaxRequest.readyState==1){document.getElementById(com_f).innerHTML='<center><img src="http://www.trip-to-hongkong.com/wp-content/themes/trip-to-hongkong/images/loading.gif"></center>';}
if(ajaxRequest.readyState==4){document.getElementById(com_f).innerHTML=ajaxRequest.responseText;}}
var li=document.getElementById(linkid).value;var ln=document.getElementById(linkname).value;var rn=document.getElementById(rname).value;var re=document.getElementById(remail).value;var rp=document.getElementById(ratep).value;var com_T=document.getElementById(com).value;var answer=confirm('do you want to proceed ?');if(answer)
{var gdata="lin="+li+"&linkname="+ln+"&rater="+rn+"&rateremail="+re+"&rateper="+rp+"&com="+com_T;ajaxRequest.open("GET","http://www.trip-to-hongkong.com/wp-content/themes/trip-to-hongkong/ratings_.php?"+gdata,true);ajaxRequest.send(null);}}
function confirmation(id_,stat_){var ajaxRequest;try{ajaxRequest=new XMLHttpRequest();}catch(e){try{ajaxRequest=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{ajaxRequest=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){alert("Your browser broke!");return false;}}}
ajaxRequest.onreadystatechange=function(){if(ajaxRequest.readyState==1){document.getElementById("loading_img").innerHTML='<center><img src="http://www.trip-to-hongkong.com/wp-content/themes/trip-to-hongkong/images/loading.gif"></center>';}
if(ajaxRequest.readyState==4){document.getElementById("loading_img").innerHTML=ajaxRequest.responseText;window.location.reload();}}
var id_get=id_;var get_stat=stat_;if(get_stat=="app")
var d="approve";if(get_stat=="del")
var d="delete";var answer=confirm('Are you sure you want to continue ?');if(answer)
{var gdata="http://www.trip-to-hongkong.com/wp-content/themes/trip-to-hongkong/rating_control_id.php?id_link="+id_get+"&st="+get_stat;ajaxRequest.open("GET",gdata,true);ajaxRequest.send(null);}}
