function CreateBookmarkLink() {
	title = "PronLinks.com - We make your life easier"; 
	url = "http://www.pronlinks.com";

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	}else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); 
	}else if(window.opera && window.print) { // Opera Hotlist
		return true; 
	}
}

function getBookmark(){
	if(/chrome/.test( navigator.userAgent.toLowerCase() )){
		document.write('Bookmark (CTRL+D)');
	}else if (window.external) {
  		document.write('<a onclick="javascript:CreateBookmarkLink()" class="whitelink" style="cursor:pointer;">Add to Favorites</a>'); 
	} else if (window.sidebar) {
  		document.write('<a onclick="javascript:CreateBookmarkLink()" class="whitelink" style="cursor:pointer;">Bookmark Page</a>'); 
	} else if (window.opera && window.print) {	
   		document.write('<a onclick="javascript:CreateBookmarkLink()" class="whitelink" style="cursor:pointer;">Add Bookmark</a>');
	} 
}

//Info Square


var square;

function popup(msg, event){
	
	
	Xoffset=-60;
	Yoffset=-75;
	
	if(msg.length < 90){
		Yoffset=-40;
	}

	if(msg.length > 135){
		Yoffset=-95;
	}
	
	if (document.all) {
        xMouse = window.event.x+document.body.scrollLeft;
        yMouse = window.event.y+document.body.scrollTop;
    } else {
        xMouse = event.pageX;
        yMouse = event.pageY;
    }
	
	square = document.getElementById("infoSquare"); 
	square.innerHTML=msg;
	
	x = xMouse + Xoffset;
	y = yMouse + Yoffset;
	square.style.left=x+"px";
	square.style.top=y+"px";
	square.style.visibility='visible';

}

function kill(){
	square.style.visibility='hidden';
}

function clear_field(fieldname, fieldstring)
{
	var field = document.getElementById(fieldname);
	
	if(field.value == fieldstring){
		field.value = "";		
	}
}

$(document).ready(function(){
  $(".whitelink").hover(

	function () {

	  $(this).animate({

	  color: "#999999"

	}, 300 );



	},

	function () {

	  $(this).animate({

	  color: "#eeeeee"

	}, 300 );      }

  );

});



function getGeneric(nr, name, description, pic_path, avg_vote, id, can_vote, rounded){
	
	var can_vote_string = "";
	
	if(can_vote){
		can_vote_string = "onMouseDown=\"star.update(event,this, "+id+")\" onMouseMove=\"star.mouse(event,this)\" title=\"Rate This!\"";
	}
	
	document.write("<a href=\"/dir/?l=link&amp;id="+id+"\" target=\"_blank\" class=\"nolink\">"+getIdDiv(nr), getNameDiv(name)+getIconDiv(description, pic_path) +"</a>"+ getReportDiv(id) + getVoteDiv(avg_vote, can_vote_string, id, rounded));
	
}

function getIdDiv(nr){
	if(nr == 0){nr ="";}
	return "<div class=\"dataId\">"+nr+"</div>";
}

function getNameDiv(name){
	return "<div class=\"dataName\">"+name+"</div>";
}

function getIconDiv(description, pic_path){
	
	if(description != ""){
		desc = "onmouseover=\"popup(\'"+description+"\', event)\" onmouseout=\"kill()\"";
	}else{
		desc = "";
	}
	
	if(pic_path == ""){
		pic_path = "style=\"background-image:url(/pics/na.jpg);\"";
	}else{
		pic_path = "style=\"background-image:url(/pics/link/"+pic_path+"/icon.jpg)\"";	
	}
	
	return "<div class=\"dataIcon\" "+pic_path + desc+"><!-- --></div>";	
}

function getVoteDiv(avg_vote, can_vote_string, id, rounded){
	return "<div class=\"dataVote\" id=\"votenr" + id + "\"><div id=\"star\"><ul id=\"star" + id + "\" class=\"star\" " + can_vote_string + "><li id=\"starCur" + id + "\" class=\"curr\" title=\"" + avg_vote + "\" style=\"width: " + rounded + "px;\" ></li></ul><div id=\"saver" + id + "\" title=\"" + avg_vote + "\"></div></div></div>";
}

function getReportDiv(id){
	return "<div class=\"dataStatus\" id=\"status" + id + "\" onclick=\"getReportSquare(" + id + ", event)\" TITLE=\"Report as broken\"><img src=\"/pics/status_normal.png\" /></div>";
}
