// JavaScript Document
function FAddMyFav()
{
document.write('<a href="javascript:window.external.addFavorite(\''+ document.location + '\',\'LAT Freight Forwarder - (Taiwan & China Forwarder)\')">Add to My Favorite</a>') ;
}

function FPrint()
{
document.write('<a href="javascript:print()"><img src="img/icon_print.gif" alt="Print" border="0"></a>') ;
}

function isPPC() {
if (navigator.appVersion.indexOf("PPC") != -1) return true;
else return false;
}

function FMailFriend(){
if(isPPC()) {
}else { 
  document.write('<a href=\"mailto:\?subject\=Take a look at this page I found, ' + document.title + '?body=You can see this page at: ' + window.location + '\" ; return true">Tell Friend<\/A>');
}
}

var sl_head = 'style="color:#990000;font-weight:bold;font-size:16px;"';
var sl_body = 'style="color: #990000; font-weight: normal; font-size: 16px;"';
var sl_g8 = 'gwls888.com';
var sl_g = 'gwls.com.tw';
var sl_hot = 'hotmail.com';
var sl_yahoo = 'yahoo.com.tw';
var sl_gm = 'gmail.com' ;
var sl_gicn = 'ginifab.com.cn' ;
var sl_gini = 'ginifab.com' ;
var sl_163 = '163.com' ;
var sl_addlines = '%0A%0A%0A%0A%0A%0A%0A%0A%0A';
var nl_oiladd = 13.5 ;

function pause(numberMillis) {
  var now = new Date();
  var exitTime = now.getTime() + numberMillis;
  while (true) {
    now = new Date();
     if (now.getTime() > exitTime) return;
  }
}

function countskype(skypename)
{
location.href = "http://www.3ccafe.com/forwarder/bill/skypecounter.php?skypename=" + skypename  + "&pageurl=" + window.location ;
pause(500);
}

function skypebutton(name,method){
  return '<a title="" href="skype:'+ name +'?'+ method +'" onClick="countskype(\'' + name + '\');" onMouseOver="skypeonMouseOver(this); return true;" onmouseout="window.status=\'\'; return true;"><img src="img/skypeme_btn_small_white.gif" border="0"></a>';
}

function clickemail(email,cc){
  window.location.href = 'mai' + 'lt' + 'o:' + email.replace(/~NoSpam~/g,"@") + js_subject + sl_addlines + window.location + '&cc='+ cc.replace(/~NoSpam~/g,"@")  ;
}

function emailbutton(email,cc){
  return '<a href="javascript:void(0)" onMouseOver="emailonMouseOver(this); return true;" onmouseout="window.status=\'\'; return true;" onclick="clickemail(\'' + email.replace(/@/g,"~NoSpam~") + '\',\'' + cc.replace(/@/g,"~NoSpam~") + '\');"><img src=\'img/icon_email.gif\' border=0></a>' ; 
}

function emailonMouseOver(anc){
  anc.title = 'Click here to email me , thank you . ^^' ;
  window.status= 'Click here to email me , i will reply you asap.' ;
}

function skypeonMouseOver(anc){
  anc.title = 'Click here to chat with me by skype or contact me by email, thank you' ;
  window.status= 'Click here to chat with me by skype or contact me by email, thank you' ;
}

function telno(no){
  today = new Date();
  hours = today.getHours();
  if ((today.getDay()==0) || (today.getDay()==6) || (hours >= 18) || (hours < 8) ) {
    return '<font color="#BBBBBB" onMouseOver="telonMouseOver(this); return true;" onmouseout="window.status=\'\'; return true;" >' + no + '</font>' ;
  } else {
    return '<font onMouseOver="telonMouseOver(this); return true;" onmouseout="window.status=\'\'; return true;" >' + no + '</font>' ;
  }
}

function telonMouseOver(anc){
  today = new Date();
  hours = today.getHours();
  hint = 'if it is off-time or holiday, please email me , we will reply you asap , thank you.'
  hint2 = 'if no body answer your phone call , please email me , we will reply you asap , thank you.'
  if ((today.getDay()==0) || (today.getDay()==6) || (hours >= 18) || (hours < 8) ) {
	anc.title = hint ;
	window.status = hint ;
  } else {
	anc.title = hint2 ;
	window.status = hint2 ;
  }
}

function FSuperSales()
{
document.write('<div id="divContactInfo">');
document.write('</div>');
loadcontactinfo('10',"divContactInfo");
}

function g8email(name)
{
return name + '@' +sl_g8 ;
}

function ShowDiv(oRad)
{
  if(oRad.style.display == 'none'){
	oRad.style.display = '';
  } else {
	oRad.style.display = 'none';
  }
}

var xmlHttp = false;
function  createRequest() {
	if(window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if(window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
	if (!xmlHttp) {
		//alert('can not creat ajax');
		return false;
	}
}

function loadcontactinfo(id,dContact) {
	createRequest();
	var url = "http://www.ginifab.com/forwarder/ajax_contactinfo.php?id=" + id + "&lang=en";
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = 
	function(){
		if(xmlHttp.readyState!=4){return; }
		if(xmlHttp.status==200){
			document.getElementById(dContact).innerHTML = xmlHttp.responseText;
		}
	};
	xmlHttp.send(null);
}
