// JavaScript Document
$(document).ready(function(){ 
	var swftempleft = $("#bannertable").position().left+220;	//320
	$("#swf_nav").css('left',swftempleft+'px');
	
	$.ajax({
		type: "POST",
		url: "share_tabs.php",
		success: function(msg){
			$('#shareLayer').html(msg);
			var templeft = $("#bannertable").position().left+964;
			$("#shareLayer").css('top',0);
			$("#shareLayer").css('left',templeft+'px');
			$('#shareLayer').css('visibility', 'visible');
		}
	});
 });

$(window).resize(function() {
  	var templeft = $("#bannertable").position().left+964;
	$("#shareLayer").css('left',templeft+'px');
	
	var swftempleft = $("#bannertable").position().left+220;	//320
	$("#swf_nav").css('left',swftempleft+'px');
})

function share() {
	$("#shareTabsHolder").slideToggle(100);
	$("#shareTabs").slideToggle(100);
};

function edm_share() {
	window.open('http://www.knorrtips.com/edm/pop_hp.php','食譜分享','toolbar=0,status=0,width=599,height=490');
}

function fbs_share() {
	//u="http://www.knorrtips.com/"+location.href;
	u=location.href;
	//t="家樂牌 -- 主頁";
	t=document.title;
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
}

function twitter_share() {
	//u="http://www.knorrtips.com/";
	u=location.href;
	//t="家樂牌 -- 主頁";
	t=document.title;
	//window.open('http://www.twitter.com/share?text='+encodeURIComponent(t), 'sharer','toolbar=0,status=0,width=626,height=436');	
	window.open('http://twitter.com/home?status='+encodeURIComponent(u), 'sharer','toolbar=0,status=0,width=626,height=436');
}

function weibo_share() {
	//u="http://www.knorrtips.com/";
	u=location.href;
	//t="家樂牌 -- 主頁";
	t=document.title;
	window.open('http://v.t.sina.com.cn/share/share.php?title='+encodeURIComponent(t)+' '+encodeURIComponent(u),'sharer','toolbar=0,status=0,width=626,height=436');
}


function bookmark() {

	if (window.sidebar) // firefox
    	window.sidebar.addPanel(document.title, this.location, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',this.location);
		elem.setAttribute('title',document.title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all)// ie
    	window.external.AddFavorite(this.location, document.title);
}
