var color1 = "#ffffee";
var color2 = "#edf8d7";
var mouseocolor = "#FFFFFF";
var sitename = "zxc9.com";
window.onerror = null;
var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);
var IE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4);
var menuActive = 0;
var menuOn = 0;
var onLayer;
var timeOn = null;
var url = window.location;
var title = document.title;
var colnow = color1;

function bookmark(title,url){
	if(window.sidebar) 
          window.sidebar.addPanel(title,url,"");
	else if(window.opera && window.print){
          var elem = document.createElement('a');
          elem.setAttribute('href',url);
          elem.setAttribute('title',title);
          elem.setAttribute('rel','nofollow');
          elem.click();
	}
	else if(os == "ie")
          window.external.AddFavorite(url,title);
}
//set the bookmark link, where you want(topright,topleft,bottomright,bottomleft)  
var corner = "bottomright";

var url = window.location;
var title = document.title;
var sitename = "zxc9.com";

document.write('<div id=ddd style="z-index: 1000; position: absolute; visibility: visible; top: 5px; border: 0px solid green;"><a href="http://zxc9.com/P10001" border="0"><img src="bookmark/add-this.gif" width="118" style="border: 0 solid gray;"></a><br><a onclick=wopmove("twitter") rel=nofollow style="font-size:14px; padding-left: 2px; text-decoration: none; cursor: pointer;" title="Twitter"><img src="bookmark/twitter.gif" alt="twitter" border=0"></a><a rel=nofollow style="font-size:14px; padding-left: 2px; text-decoration: none; cursor: pointer;" onclick=wopmove("facebook") title="facebook"><img src="bookmark/facebook.gif" alt="Bookmark" border=0"></a><a rel=nofollow style="font-size:14px; text-decoration: none; cursor: pointer; padding-left: 2px; cursor: pointer;" onclick=wopmove("google") title="google"><img src="bookmark/bookmark-google.gif"></a><a style="font-size:14px; padding-left: 2px; text-decoration: none; cursor: pointer;" onclick=wopmove("delicious") title="delicious" rel=nofollow ><img src="bookmark/delicious.gif" alt="Bookmark" border=0"></a><a style="font-size:14px; cursor: pointer; padding-left: 2px; text-decoration: none;" onclick=wopmove("digg") title="Digg" rel=nofollow ><img src="bookmark/digg.gif" alt="Bookmark" border=0"></a><a style="font-size:14px; padding-left: 2px; text-decoration: none; cursor: pointer;" onclick=wopmove("stumbleupon") title="Stumble upon" rel=nofollow><img src="bookmark/stumble-upon.gif" alt="stumble upon" border=0"></a></div>');
  //document.write('<div id=ddd style="position: absolute; visibility: visible; top: 5px; left:5px; border: 1px solid green;"><img src="bookmark/twitter.gif" alt="Bookmark" border=0"></a></div>');
var os;
if(document.layers)
 os = "n4";
else if(document.getElementById&&!document.all)
 os = "n6";
else if(document.all)
 os = "ie";

//Function to scroll the bookmark images throughout the page
function run()
{
 var dda = document.getElementById('ddd');
 if(os == "ie"){
   pwidth = window.document.body.offsetWidth;
   pheight = window.document.body.offsetHeight;
   stop = document.body.scrollTop;
   sleft = document.body.scrollLeft;
   document.getElementById('ddd').style.position="absolute";
  // setTimeout('run()',5);
 }else{
   pwidth = window.innerWidth;
   pheight = window.innerHeight;
   stop = window.pageYOffset;
   sleft = window.pageXOffset;
   document.getElementById('ddd').style.position="fixed";
}

  if(corner == "topleft"){
    dda.style.top = (stop+15)+"px";
    dda.style.left = (sleft+15)+"px";
  }else if(corner == "topright"){
    dda.style.top = (stop)+"px";
    dda.style.left = (sleft+pwidth-60)+"px";  
  }else if(corner == "bottomleft"){
    dda.style.top = (stop+pheight-43)+"px";
    dda.style.left = (sleft+15)+"px";
  }else if(corner == "bottomright"){
    dda.style.top = (stop+pheight-70)+"px";
    dda.style.left = (sleft+pwidth-140)+"px";  
  }
}
function wopmove(id)
{
if(id == "stumbleupon")
		window.location = "http://www.stumbleupon.com/submit?url="+url+"&title="+title;
	if(id == "delicious")
		window.location = "http://del.icio.us/post?url="+url+"&title="+title+"&notes="+title;
	if(id == "facebook")
		window.location = "http://www.facebook.com/share.php?u="+encodeURI(url)+"&t="+encodeURI(title);
	if(id == "twitter")
window.location = "http://twitter.com/home?status="+title+" "+url;
	if(id == "yahoo")
		window.location = "http://myweb2.search.yahoo.com/myresults/bookmarklet?u="+url+"&t="+title;
	if(id == "digg")
	window.location = "http://digg.com/submit?phase=2&url="+encodeURI(url)+"&title="+encodeURI(title);
if(id == "google")
		window.location = "http://www.google.com/bookmarks/mark?op=add&bkmk="+url+"&title="+title+"&labels="+sitename;
	
}
document.onload = run();
function showLayer(layerName,aa){
	var x =document.getElementById(aa);
	var tt =findPosX(x);
	var ww =findPosY(x)+18;
	
	//alert(tt+"---"+ww);

	if (timeOn != null) {
	clearTimeout(timeOn);
	hideLayer(onLayer);
	}
	if (IE4) {
	var layers = eval('document.all["'+layerName+'"].style');
	layers.left = tt;
	layers.top = ww;
	eval('document.all["'+layerName+'"].style.visibility="visible"');
	}
	else {
		if(document.getElementById){
		var elementRef = document.getElementById(layerName);
		if((elementRef.style)&& (elementRef.style.visibility!=null)){
		elementRef.style.visibility = 'visible';
		elementRef.style.left = tt;
		elementRef.style.top = ww;
		}
		}
	}
	onLayer = layerName
}

function hideLayer(layerName){
	if (menuActive == 0)
	{
		if (IE4){
		eval('document.all["'+layerName+'"].style.visibility="hidden"');
		}
		else{
			if(document.getElementById){
				var elementRef = document.getElementById(layerName);
				if((elementRef.style)&& (elementRef.style.visibility!=null)){
					elementRef.style.visibility = 'hidden';
				}
			}
		}
	}
}

function btnTimer() {
	timeOn = setTimeout("btnOut()",600)
}

function btnOut(layerName){
	if (menuActive == 0){
	hideLayer(onLayer)
	}
}

var item;
function menuOver(itemName){
	item=itemName;
	itemName.style.backgroundColor = mouseocolor; //background color change on mouse over
	clearTimeout(timeOn);
	menuActive = 1
}

function menuOut(itemName,iid){
	if(iid == 1)
		colnow = color1;
	else
		colnow = color2;

	if(item)
		itemName.style.backgroundColor = colnow;
	menuActive = 0
	timeOn = setTimeout("hideLayer(onLayer)", 100)
}

function findPosX(obj)
{
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)
curleft += obj.x;
return curleft;
}

function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}

