/**
 * SmartWD FrameWork System Version 2.0 BETA.
 * JavaScript FrameWork Version 1.0 BETA.
 *
 * @author    Haim Yuhter <haim AT smartwd DOT com>
 * @author    Daniel Ohayon <daniel AT smartwd DOT com>
 * @copyright 2008-2009 SmartWD © <www.smartwd.com> All right reservd
 * @version   1.0 BETA
 * @link      http://www.SmartWD.com
 */

/**
 * Projects Section - website functions
 */
var iProject = {
	Show: function( id )
	{
        $(".p"+id+"-hover").fadeIn("normal");
	},
	Hide: function( id )
	{
        $(".p"+id+"-hover").fadeOut("slow");
	},
	Move: function( url , id , target )
	{
		if( target == 0 )// target: _self
		    window.location = url;
		if( target == 1 )
		    window.open( url );
	}
};
$(document).ready(function(){
	$("table.g_content td , table.b_content td").each(function(m,v){
		if( $("div" , v )[0] ){
			var id = /p([0-9]+)\-hover/.exec( $("div.image_hover", v)[0].className );
			var parentt = v.parentNode.parentNode.parentNode;
			parentTop = parentt.offsetTop ;//+ parent2.offsetTop;
			parentLeft = parentt.offsetLeft ;//+ parent2.offsetLeft;
			div = document.createElement("div");
			if( id && $(".p"+Number(id[1])+"-href")[0] )
			var divclick = $(".p"+Number(id[1])+"-href").attr('href');
			div.style.width = v.offsetWidth+"px";
			div.style.height = v.offsetHeight+"px";
			div.style.top = ($( v ).offset().top)+"px";
			div.style.left = ($( v ).offset().left)+"px";
			div.style.zIndex = 9999999;
			div.style.cursor = "pointer";
			div.style.position = "absolute";
			div.style.background = "#000000";
			var op = 0;
			div.style.filter = "alpha(opacity="+op+")";
        	div.style.MozOpacity = (op/100);
        	div.style.KhtmlOpacity = (op/100);
        	div.style.opacity = (op/100);
			div.onmouseover = function() {
				iProject.Show( Number(id[1]) );
			}
			div.onmouseout = function() {
				iProject.Hide( Number(id[1]) );
			}
			div.onclick = function() {
				iProject.Move( divclick , Number(id[1]) , project_target[Number(id[1])] );
			}
			if( id != null )
				$("body")[0].appendChild( div );
		}
	});
});