﻿//-------------------------------------------------------------------------------------------------------------------
// Social Bookmark popup script
// Copyright 2007 ITSTH - www.easy2sync.com
// May be used without charge on noncommercial and commercial website as long as this header is left intact
//
// Version 1.0 - For the latest version see:
// http://www.easy2sync.com/en/ueber/dev_social_bookmarks.php
//-------------------------------------------------------------------------------------------------------------------
sb_iconpath = "/images/wjx/ico_share/";
sb_text     = "<span style='color:#3d81ee;font-size:13px'>收藏本页</span>";

function addto(index){
		//if (!this.AddURL) 
		   var metas = document.getElementsByTagName("meta");
		   var tags;
		   var title=document.title; 
		   var d="";
		   for(var i=0;i<metas.length;i++)//标签
		   {
		       if(metas[i].name.toLowerCase()=="keywords")
		       {    tags = metas[i].content;
		        	
		       }
		       else if(metas[i].name.toLowerCase()=="description")
		       { 
		             d = metas[i].content;
		        	 
		       }
		   }
          var desc = document.getElementById("ctl00_ContentPlaceHolder1_JQ1_lblQuestionnaireDescription");
          
          if(desc)//填写问卷页面描述
              d= desc.innerHTML.replace(/<.+?>/gim,'');
         var  AddURL;var AddTitle; var Description;var Label;
		   if(sns[index].encode=="0")
		   {
		      AddURL = escape(document.location.href);
		       AddTitle = escape(title);
		       Description = escape(d.substring(0,100));
		        Label = escape("tags");
		    }
		   else
		   	{
		   	  AddURL  = encodeURIComponent(document.location.href);
		   	  AddTitle = encodeURIComponent(title);
		   	  Description = encodeURIComponent(d.substring(0,100));
		      Label = encodeURIComponent(tags);
		   	}
		
		var addtoFullURL = sns[index].url + sns[index].urlVar + "=" + AddURL + 
			"&" + sns[index].titleVar + "=" + AddTitle + sns[index].otherVars;
		if (sns[index].noteVar != "") //标签
			addtoFullURL = addtoFullURL + "&" + sns[index].noteVar + "=" + Label;
		if (sns[index].returnVar != "")//描述
			addtoFullURL = addtoFullURL + "&" + sns[index].returnVar + "=" + Description;
        
        var popupWin = window.open(addtoFullURL,'添加到收藏');
		if (window.focus) {popupWin.focus()}
		return false;
	};
function sb_setlayer(name, vis)
{ 
  var d = document.getElementById(name);
  d.style.display= vis?"":"none";
}

sb_menutimeout=0;

function sb_setmenu(name, vis)
{
   if (vis)
   {
      if (sb_menutimeout)
      {
         window.clearTimeout (sb_menutimeout);
         sb_menutimeout=0;
      }
      sb_setlayer(name, vis);
   }
   else
   {
      sb_menutimeout = window.setTimeout ("sb_setlayer('"+name+"', false)", 100);
   }
}


function sb_makelink(link)
{
   link = link.replace(/!LINK!/, escape(location.href));
   link = link.replace(/!TITLE!/, escape(document.title));

   return(link);
}

function sb_writelink(link, icon, name)
{
   document.write('<a href="'+link+'"  target=_blank>&nbsp;<img src="'+sb_iconpath+icon+'" align=middle border=0>&nbsp;'+name+'&nbsp;</a><br>\n');
}
function sb_writesns(index)
{
   document.write("<a href='javascript:void(0);' onclick='javascript:return addto("+index+");' style='cursor:pointer;'>&nbsp;<img src='"+sb_iconpath+sns[index].image+"' align=middle border=0>&nbsp;"+sns[index].name+"&nbsp;</a><br/>");
}
sns=[
	 { name:'百度',	image: 'ico_baidu.gif',		url: 'http://cang.baidu.com/do/add?', urlVar: 'iu',titleVar: 'it',	noteVar: 'tn',	returnVar: 'dc', encode:'1',	otherVars: '' },
	 { name:'Google书签',		image: 'ico_Google.gif', url: 'http://www.google.com/bookmarks/mark?',		urlVar: 'bkmk',	titleVar: 'title',	noteVar: 'labels',	returnVar: 'annotation', encode:'1',	otherVars: '&op=edit' },
	 { name:'QQ书签',	image: 'ico_qq.gif',	url: 'http://shuqian.qq.com/post?',			urlVar: 'uri',	titleVar: 'title',	noteVar: '',	returnVar: '', encode:'1',	otherVars: '&jumpback=2&noui=1&from=3' },
	 { name:'新浪ViVi',	image: 'ico_vivi.gif',	url: 'http://vivi.sina.com.cn/collect/icollect.php?',			urlVar: 'url',	titleVar: 'title',	noteVar: '',	returnVar: 'desc',	 encode:'0',otherVars: '&pid=2008' },
	 { name:'雅虎收藏',	image: 'ico_Yahoo.gif',		url: 'http://myweb.cn.yahoo.com/popadd.html?', urlVar: 'url', titleVar: 'title',	noteVar: 'tag', returnVar: 'ch1',  encode:'1',otherVars: '&d=&ei=UTF-8' },
	 { name:'天天网摘',	image: 'ico_365key.gif',	url: 'http://www.365key.com/storeit.aspx?',		urlVar: 'u',	titleVar: 't',		noteVar: '',	returnVar: 'c',	 encode:'0',otherVars: '' },
	 { name:'天极网摘',			image: 'ico_yesky.gif',		url:'http://hot.yesky.com/dp.aspx?', urlVar: 'u', titleVar: 't', noteVar: '', returnVar: 'c',  encode:'0',otherVars: '&st=2' },

	];
document.write('<span style="position:relative; display:inline;">\n');
document.write('<a href="#" title="添加到收藏夹" class="link-666" style="background-image:url('+sb_iconpath+'add.gif); background-repeat:no-repeat; padding-top:3px;  padding-left:18px;" onMouseOver="sb_setmenu(\'menu_sb\', true, this)" onMouseOut="sb_setmenu(\'menu_sb\', false, this)"><b>'+sb_text+'</b></a>');//<br>\n
document.write('<div id="menu_sb" style="position:absolute;width:140px; left:0px; top: 16px; display:none;text-align:left;clear:both;">\n');
document.write('\n');
document.write('<table cellspacing=0 cellpadding=5 border=0 bgcolor=#ffffff><tr><td onMouseOver="sb_setmenu(\'menu_sb\', true)" onMouseOut="sb_setmenu(\'menu_sb\', false)" style="border:1px solid #606060; ">\n');
sb_writesns(0);sb_writesns(1);sb_writesns(2);sb_writesns(3);sb_writesns(4);sb_writesns(5);sb_writesns(6);
document.write('</td></tr></table><br style="clear:both"/></div></span>\n');//