function close_overlay()
{
	$("#addComment").hide();
}

$(document).ready(function(){


$(".categories ul li:last-child a").css("border",0);


if ( $.browser.msie && ($.browser.version).indexOf("6.0")>-1) {
var width_cr=$(".highlightStep .highlightPhotoWrap .highlightPhoto .photo a.enlargePic img").width();
$(".highlightPhotoWrap").css("width",width_cr+"px");
}


if($.browser.msie)
{
$("div.leftCatnav + div.rigtCategory").css("margin-bottom","50px");
/*
if(($.browser.version).indexOf("6.0")>-1)
{
$("div.leftCatnav + div.rigtCategory").css("margin-bottom","-10px");
}
else
{
$("div.leftCatnav + div.rigtCategory").css("margin-bottom","40px");
}*/
} 

/*Hidding dotted line for anchor tags */

$('a').focus(function(){
     $(this).blur();
});

/*end here*/



/* Adding page number border*/
$(".comment_paging a:first,#ctl00_MainContent_ProjectComment1_pnlPagingBottom a:first,#ctl00_MainContent_ctl01_pnlPagingBottom a:first ").css("border-left","1px solid #E2E1DE");



/*Adding Overlay Back to disable back links*/
$("#overlay_back").css("width",$("body").width()+"px");
$("#overlay_back").css("height",$("body").height()+"px");


/* Hiding overlay box when click outside of overlay*/



var check=0;

if($("div.proLinks").attr("class"))
{
if($("div.proLinks").height()>38)
{
$("div.proLinks").css("height","35px");
$("div.expandProject").show();
$("div.expandProject").css("bottom","18px");
}
else
{
$("div.expandProject").hide();
}
}
var box_height;

if($.browser.safari){
      box_height=39;
	  }else{
      box_height=47;
   }

if($("p.proLinks").attr("class"))
{
if($("p.proLinks").height()>box_height)
{
$("p.proLinks").css("height",(box_height-2)+"px");
$("div.expandProject").show();
$("div.expandProject").css("bottom","7px");
}
else
{
$("div.expandProject").hide();
}
}


$("a#expand_project").click(function(){
	if(check%2==0)
		{
			$(".proLinks,.diy_proLinks").css("height","auto");
			$(this).html("less").removeClass("expand_pro").addClass("close_pro");
			check=1;
		}
	else
		{
			$(".proLinks").css("height","35px");
			$(".diy_proLinks").css("height",(box_height-2)+"px");
			$(this).html("more").addClass("expand_pro").removeClass("close_pro");
			check=0;
		}
		return false;
});

// Tabs code for project detail
$("#diyprojectNavigation_1 a").click(function(){
	$("#diyprojectNavigation").find(".active").removeClass("active");
	$(this).addClass("active");
	$("#diy_wrapper").find(".sectionActive").addClass("sectionNotactive")
						.removeClass("sectionActive");
	var active=$(this).attr("id")+"Box";
	$("#"+active).addClass("sectionActive")
	        	.removeClass("sectionNotactive");
	//return false;
});

$("a#step_pageinnertab_1").click(function(){
	$("#diyprojectNavigation").find(".active").removeClass("active");
	$("a#ctl00_MainContent_stepbystep").addClass("active");
	$("#diy_wrapper").find(".sectionActive").addClass("sectionNotactive")
				.removeClass("sectionActive");
	$("#ctl00_MainContent_stepbystepBox").addClass("sectionActive")
	$("#ctl00_MainContent_stepbystepBox").removeClass("sectionNotactive");
	return false;
});



//Hover text and box hide code for project detail
var len,my_class,i,flag=1,active_class=false,c_id,control_id,chk=0;
$(".hoverMe").hover(
      function () 
	  {
        my_class=$(this).attr("class");
		control_id=$(this).attr("id");
		if(control_id)
		chk=1;
		else
		chk=0;
		my_class=my_class.split(" ");
		len=my_class.length;
		for(i=0;i<len;i++)
			{
				if(my_class[i].indexOf('hover_-')>-1)
				{
					if(flag==1){active_class=my_class[i];flag=0;}
					c_id=active_class.split("_-");
					c_id=c_id[1];
					if(chk==0)
					$("#"+c_id+" ."+my_class[i]+"_text").show();
				}			
			}
      		}, 
      		function () 
			  {
	    		if(active_class)
				{
					$("#"+c_id+" ."+active_class+"_text").css("display","none");;
					flag=1;
				}
      });
	  
	  // Hide box
	  $(".hoverMe").click(function(){	    
	    make_blank();//added by vinit, please ensure for future releases
	  	$(this).parents("#"+c_id).css("display","none");
		$("#overlay_back").hide();
	  	return false;
	  });
	  
	  // Center Overlay
	  /*$(".addComment-overlay").click(function(){
		var top_location=document.documentElement.scrollTop;
		var client_width=(document.body.clientWidth)-509;
		if ($.browser.safari)
		{
  		  top_location=document.body.scrollTop;
		}
		top_location=top_location+50;
		$("#addComment,#loginBox,#loginBoxThumbsUP").css("top",top_location);
		$("#addComment,#loginBox,#loginBoxThumbsUP").css("left",client_width/2);
		//$("#addComment").css("display","block");;
 		return false;
		});*/
		
		
		
		
		var ids_col=new Array("timebox_data","complexitybox_data","costbox_data"),i_index=0;
	$('#rightColumntxt div').each(function(){
	if($(this).attr("class")=="details")
	{
		$(this).attr("id",ids_col[i_index]);
		i_index=i_index+1;

	}});
		
		$("a.show_detail").click(function(){
$(".details-box").css("display","none");
var myid=$(this).attr("id")+"box";
var zdex=9999;
$(".details").each(function(){
var p_id=$(this).attr("id");
if(p_id.indexOf(myid)>-1)
{
$("#"+p_id).css("z-index",zdex);
}
else
{
$("#"+p_id).css("z-index",zdex-1);
}
});

$("#"+myid).css("display","block");

return false;
});
});



function roll_over(img_name, img_src)
{
    document[img_name].src = img_src;
}
   
function hide_showbox(box_id,box_status,flag)
{
    var hypJoinNow = document.getElementById("ctl00_MainContent_commentLogin_hypJoinNow");
    var hidReturnUrl = document.getElementById("ctl00_MainContent_commentLogin_hidReturnUrl");
    var hidRegistrationSrc = document.getElementById("ctl00_MainContent_commentLogin_hidRegistrationSrc");

    document.getElementById("ctl00_MainContent_commentLogin_hidFlagValue").value = flag;
    
    if(hidRegistrationSrc.value != "")
    {
        hypJoinNow.href = "/Join-Now.aspx?pmcode=TFHSite&RegistrationSource=" + hidRegistrationSrc.value;
    }
    else
    {
        if(flag)
            hypJoinNow.href = "/Join-Now.aspx?pmcode=TFHSite&RegistrationSource=Add a Comment";
        else
            hypJoinNow.href = "/Join-Now.aspx?pmcode=TFHSite&RegistrationSource=Tools - Like";
    }
    
    if(hidReturnUrl.value != "")
        hypJoinNow.href = hypJoinNow.href  + "&ReturnURL=" + hidReturnUrl.value;
    
    var scnWid,scnHei;
	if (self.innerHeight) // all except Explorer
	{
		scnWid = self.innerWidth;
		scnHei = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		scnWid = document.documentElement.clientWidth;
		scnHei = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		scnWid = document.body.clientWidth;
		scnHei = document.body.clientHeight;
	}
	lTop = 0;
	if ( $.browser.msie && ($.browser.version).indexOf("6.0")>-1) {
	var lTop=document.documentElement.scrollTop;
	if ($.browser.safari) {lTop=document.body.scrollTop;}
	}

	 $("#"+box_id).css("top",lTop + (scnHei - $("#"+box_id).height())/2);
     $("#"+box_id).css("left",(scnWid - $("#"+box_id).width())/2);


    if(box_status)
	{
    $("#overlay_back").show();
	$("#"+box_id).show();
	}
    else 
	{
	$("#"+box_id).hide();
    $("#overlay_back").hide();
	}
	$(window).resize(function() {
	  hide_showbox(box_id,box_status,flag);
	});
	if ( $.browser.msie && ($.browser.version).indexOf("6.0")>-1) {
	$(window).scroll(function() {
	lTop=document.documentElement.scrollTop;
	if ($.browser.safari) {lTop=document.body.scrollTop;}
	$("#"+box_id).css("top",lTop + (scnHei - $("#"+box_id).height())/2);
	});	

	}
    


}




function DisableLinks()
{
    var imgbtnYouLike = document.getElementById("ctl00_MainContent_imgbtnYouLike");
    var lnkbtnYouLike = document.getElementById("ctl00_MainContent_lnkbtnYouLike"); 
    imgbtnYouLike.disabled  = true;    
    lnkbtnYouLike.href = "javascript:void();";
    lnkbtnYouLike.innerHTML = 'I Like';
    lnkbtnYouLike.setAttribute("class","SelectedPageState");   
}