this.tooltip = function(){	
		
		xOffset = 20;
		yOffset = 10;		
				
	$("img.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("img.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};
/*
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
sidemenu = function (id, sx, sy)
{
	var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
	var px = document.layers ? "" : "px";
	window[id + "_obj"] = el;
	if(d.layers)el.style=el;
	el.cx = el.sx = sx;el.cy = el.sy = sy;
	el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};

	el.floatIt=function()
	{
		var pX, pY;
		pX = (this.sx >= 0) ? 0 : ns ? innerWidth : 
		document.documentElement && document.documentElement.clientWidth ? 
		document.documentElement.clientWidth : document.body.clientWidth;
		pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? 
		document.documentElement.scrollTop : document.body.scrollTop;
		if(this.sy<0) 
		pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ? 
		document.documentElement.clientHeight : document.body.clientHeight;
		this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8;
		this.sP(this.cx, this.cy);
		setTimeout(this.id + "_obj.floatIt()", 40);
	}
	return el;
};
*/

var width = 800;
var height = 700;
var top = 50;
var left = 50;
var addText = "Check This : ";
var title = document.title;
var enTitle = encodeURIComponent(title);
var deTitle = decodeURIComponent(title);
var pageURL = document.location.href;
var enPageURL = encodeURIComponent(pageURL);

facebook = function(){
	var title = addText + " " + document.title;
	window.open('http://www.facebook.com/sharer.php?u='+enPageURL+'&t='+title,'FaceBook','toolbar=0,top='+top+',left='+left+',status=0,resizable=yes,scrollbars=yes,width='+width+',height='+height);
};

twitter = function()
{  
	var appendText =  addText +" "+deTitle;
		if(appendText.length > 40){
			appendText = appendText.substring(0,40);
			appendText = appendText + "...";
		}
		appendText = encodeURIComponent(appendText);
		pageURL = appendText + " " + pageURL;
	var compURL = "http://twitter.com/home?status="+pageURL;
		window.open(compURL, "twitter", "top="+top+", left="+left+",menubar=no,location=yes,resizable=yes,scrollbars=yes,status=yes,width="+width+",height="+height);
};

digg = function()
{ 
		var digTitle = deTitle.replace(/ /g,"+");
	var compURL = "http://digg.com/submit?phase=2&url="+enPageURL+"&title="+digTitle;		
		window.open(compURL, "Digg", "top="+top+", left="+left+",menubar=no,location=yes,resizable=yes,scrollbars=yes,width="+width+",height="+height);    
};

delicious = function()
{   
	var compURL = "http://del.icio.us/post?&url="+enPageURL+"&title="+title;
		window.open(compURL, "delicious", "top="+top+", left="+left+",menubar=no,location=yes,resizable=yes,scrollbars=yes,width="+width+",height="+height);
};

stumbleupon = function()
{  
	var compURL = "http://www.stumbleupon.com/submit?url="+enPageURL+"&title="+enTitle;
        window.open(compURL, "stumbleupon", "top="+top+", left="+left+",menubar=no,location=yes,resizable=yes,scrollbars=yes,width="+width+",height="+height);
};

google = function(){
var compURL = "http://www.google.com/bookmarks/mark?op=add&hl=en&bkmk="+pageURL+"&title="+title;
	window.open(compURL, "Google", "top="+top+", left="+left+",menubar=no,location=yes,resizable=yes,scrollbars=yes,width="+width+",height="+height);
		
};
orkut = function(){
var compURL = "http://www.orkut.co.in/Main#Community?cmm=40161844";
	window.open(compURL, "Orkut", "top="+top+", left="+left+",menubar=no,location=yes,resizable=yes,scrollbars=yes,width="+width+",height="+height);
		
};
youtube = function(){
var compURL = "http://www.youtube.com/themycollection";
	window.open(compURL, "Youtube", "top="+top+", left="+left+",menubar=no,location=yes,resizable=yes,scrollbars=yes,width="+width+",height="+height);
		
};
technorati = function(){
var compURL = "http://technorati.com/faves?add="+pageURL;
	window.open(compURL, "Technorati", "top="+top+", left="+left+",menubar=no,location=yes,resizable=yes,scrollbars=yes,width="+width+",height="+height);
		
};

// starting the script on page load
$(document).ready(function(){
	tooltip();
	//sidemenu("divTopLeft", 1,165).floatIt();
	
	//sidemenu("divTop", -120,1).floatIt();
	//sidemenu("divTopRight", -70,165).floatIt();
	$("img#igb").click(function () { 
      google(); 
    });
	$("img#ifb").click(function () { 
      facebook(); 
    });
	$("img#itw").click(function () { 
      twitter(); 
    });
	$("img#idg").click(function () { 
      digg(); 
    });
	$("img#ide").click(function () { 
      delicious(); 
    });
	$("img#ist").click(function () { 
      stumbleupon(); 
    });
	$("img#iyt").click(function () { 
      youtube(); 
    });
	$("img#itn").click(function () { 
      technorati(); 
    });
	$("img#iot").click(function () { 
      orkut(); 
    });
});