var msgId=null;
var ServerURL=null;
var EmailBody=[{
			   "title":"China Sourcing",
			   "body":"%0d%0d%0a Note:Your email is sent to a primary and a backup address to ensure reliable delivery.  We will reply you within 24 hours."
			   }];
var isCreateIfmane=false;
function SetEmail(Email,ccEmail,num,str)
{
	if(str=="")str=Email;
	 document.write("<a href=\"mailto:"+Email+"?cc="+ccEmail+"&subject="+EmailBody[num].title+"&body="+EmailBody[num].body+"\" onclick=\"doCountEmail('"+Email+"')\">"+str+"<\/a>");
	 CreateIfrmane();
}
function CreateIfrmane()
{
	if(isCreateIfmane==false)
	{
	 document.write("<iframe width=\"0\" height=\"0\" style=\"display:none\" id=\"Google\" name=\"Google\"></iframe>");
	  document.write("<iframe width=\"0\" height=\"0\" style=\"display:none\" id=\"EmailCountIframe\" name=\"EmailCountIframe\"></iframe>");
	  isCreateIfmane=true;
	}
}
function doCountEmail(strmail)
{
	document.getElementById("Google").src=ServerURL+"\/js\/google.html";
	document.getElementById("EmailCountIframe").src=ServerURL+"\/Count\/Count.asp?t=email&id="+msgId+"&WebName="+CountWebName+"&u="+window.location.href+"&e=Email:"+strmail;
}
function doCountButtion(str)
{
	document.getElementById("EmailCountIframe").src=ServerURL+"\/Count\/Count.asp?t=email&id="+msgId+"&WebName="+CountWebName+"&u="+window.location.href+"&e=Button:"+str;
}
function InquiryDialog(id,FormId)
{
	this.id=id;
	this.height=200;
	this.width=300;
	this.bgcolor="#333333";
	this.form="DialogForm";
	var isCreate=false;
	this.createDialog=function(){
			var bs = $('<div name="' + this.id + '" id="' + this.id + '"></div>');	
			$(bs).css('position', 'absolute');
			$(bs).css('display', 'none');
			$(bs).css('z-index', '10');
			$(bs).css('background-color', this.bgcolor);
			$(bs).addClass("DialogBs"); 
			var DialogForm=$('<div name="' + this.form + '" id="' + this.form + '"></div>');
			$(DialogForm).css('position', 'absolute');
			$(DialogForm).css('z-index', '11');
			$(DialogForm).css('display', 'none');
			if(FormId.indexOf(".")>0)
			{
				$.get(FormId, function(data){ // grab content from another page
					$(DialogForm).html(data);
				});
				
			}
			else
			{
				$(DialogForm).html($(FormId).html());
				$(FormId).html("");
			}
			$(DialogForm).appendTo('body');	
			$(bs).appendTo('body');	
			isCreate=true;
		};
		this.resize=resize;
		function resize()
		{
			var h,w;
			h=($("#"+this.form).height()==0)?this.height:$("#"+this.form).height();
			w=($("#"+this.form).width()==0)?this.width:$("#"+this.form).width();			
			$("#"+this.id).css('top', $(document).scrollTop()+"px");
			$("#"+this.id).css('left', $(document).scrollLeft()+"px");
			$("#"+this.id).css('top', $(document).scrollTop()+"px");
			$("#"+this.id).css('height', $(window).height() +"px");
			$("#"+this.id).css('width', $(window).width() +"px");
			$("#"+this.form).css('top', ($(document).scrollTop()+($(window).height()-h)/2)+"px");
			$("#"+this.form).css('left', ($(document).scrollLeft()+($(window).width()-w)/2)+"px");
		}
		
	this.show=function()
	{
		if(isCreate==false)this.createDialog();
		this.resize();
		$("#"+this.id).show();
		$("#"+this.form).show();

	};
	this.hide=function(){
		$("#"+this.id).hide();
		$("#"+this.form).hide();
		};
	$(window).resize(function(){
			resize();
		}); 
	
}
function doSubmitInquiry(obj)
{
	obj.WebName.value=CountWebName;
	obj.url.value=window.location.href;
	obj.pageid.value=msgId;
}
var CountVisiterURL="";
window.onblur=function()
{
	getIshasCountVisiter();
	if(CountVisiterURL!="")document.getElementById("CountVisiter").src=CountVisiterURL+"#stop";
	
}
window.onfocus=function()
{
	getIshasCountVisiter();
	if(CountVisiterURL!="")document.getElementById("CountVisiter").src=CountVisiterURL+"#start";
	
}


function getIshasCountVisiter()
{
	if(document.getElementById("CountVisiter") && CountVisiterURL=="")
	{CountVisiterURL=document.getElementById("CountVisiter").src;}
}
// JavaScript Document