// JavaScript Document
function FAddMyFavority(name)
{
document.write('<a href="javascript:window.external.addFavorite(\''+ document.location + '\',\'' + name +'\')"><img src="img/icon_favorite_en.gif" alt="Add to Favorit" border="0"></a>') ;
}

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

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

function FMailFriend(){
if(isPPC()) {
  //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">mail to friends<\/A>');
}else {
  document.write('<a href=\"mailto:\?subject\=There is an interesting web site. &body\=Hi:%0ATake a look if you have spare time. %0A%0A' + document.title + '%0A' + window.location + '%0A%0AVisit Visit Visit!!\";  return true"><img src="img/icon_friend_en.gif" alt="mail to friends" border="0"><\/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_spot = 'spot25.com' ;
var sl_gicn = 'ginifab.com.cn' ;
var sl_163 = '163.com' ;
var sl_addlines = '%0A%0A%0A%0A%0A%0A%0A%0A%0A';
var sl_clickemail = '<span ' + sl_body + '>(click left button to email)</span>';
var nl_oiladd = 13.5 ;
var sl_gini = 'ginifab.com';

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_en.gif\' border=0></a>' ;
}

function emailonMouseOver(anc){
  anc.title = 'Click here to email me , thank you !' ;
  window.status= 'Click here to email me !' ;
}

function skypeonMouseOver(anc){
  anc.title = 'Click here to chat wiht me via Skype.\nEmail to me if no one answer, thank you very much.' ;
  window.status= 'Click here to chat wiht me via Skype. Email to me if no one answer, thank you very much.' ;
}

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 nobody answer , please email to me , thank you .' ;
  hint2 = 'If nobody answer , please email to me , 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 FGiftSales()
{
document.write('<div id="divContactInfo">');
document.write('<table align="center" width="80%" border="1" cellspacing="1" cellpadding="1"><tr '+sl_head+'><td nowrap>Location</td><td nowrap>contacts</td><td nowrap >EMail</td><td nowrap >messanger</td><td nowrap >Cell</td></tr>') ;
document.write('<tr><td '+ sl_head+'">China</td><td '+ sl_head+'">David Wang</td><td nowrap '+ sl_head+'>'+ emailbutton('davidwang@'+sl_spot,'dw4363@'+sl_gm) +'</td><td '+ sl_body +'>'+ skypebutton('dw4363','chat') +'</td><td nowrap>'+ telno('+86-1377-604-4400')+'&nbsp;</td></tr>') ;
document.write('<tr><td '+ sl_head+'">Taiwan</td><td '+ sl_head+'">Eric Lin</td><td '+ sl_head +'>' + emailbutton('promoia@'+sl_hot ,'dw4363@'+sl_gm) +'</td><td '+ sl_body +'>'+ skypebutton('cableeric','chat') +'</td><td nowrap>'+ telno('+886-920-909-163')+'&nbsp;</td></tr>') ;
document.write('</table>');
document.write('</div>');
loadcontactinfo(13,"divContactInfo");
}

function FGiftSales_en(id)
{
document.write('<div id="divContactInfo">');
document.write('<table align="center" width="80%" border="1" cellspacing="1" cellpadding="1"><tr '+sl_head+'><td nowrap>Location</td><td nowrap>contacts</td><td nowrap >EMail</td><td nowrap >messanger</td><td nowrap >Cell</td></tr>') ;
document.write('<tr><td '+ sl_head+'">China</td><td '+ sl_head+'">David Wang</td><td nowrap '+ sl_head+'>'+ emailbutton('davidwang@'+sl_spot,'dw4363@'+sl_gm) +'</td><td '+ sl_body +'>'+ skypebutton('dw4363','chat') +'</td><td nowrap>'+ telno('+86-1377-604-4400')+'&nbsp;</td></tr>') ;
document.write('<tr><td '+ sl_head+'">Taiwan</td><td '+ sl_head+'">Eric Lin</td><td '+ sl_head +'>' + emailbutton('promoia@'+sl_hot ,'dw4363@'+sl_gm) +'</td><td '+ sl_body +'>'+ skypebutton('cableeric','chat') +'</td><td nowrap>'+ telno('+886-920-909-163')+'&nbsp;</td></tr>') ;
document.write('</table>');
document.write('</div>');
loadcontactinfo(13,"divContactInfo");
}

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 = "../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);
}