var content;
var full;
var mini;
var interval;
var isClick = false;
var delay = 250;
var more_pic = "/i/more-btn.gif";
var less_pic = "/i/less-btn.gif";

var hiddeMainContentBoxInt = null;
var ContentBoxCanHidde = true;
function isset( variable )
{
	if(variable && variable != null && variable != "undefined"){
		return true;
	}
	return false;
}
try{ ContentBoxCanHidde = !isset( ContentBoxCanNotHidde ); }catch(e){}
function hiddeMainContentBox()
{
    if(!($("#full-view .content").css('display') == 'none') &&  ContentBoxCanHidde)
    {
       $("#full-view .content").slideToggle();
    }
    clearInterval(hiddeMainContentBoxInt);
}

$(function() {
	
	content = document.getElementById("content-box");
	full = document.getElementById("full-view");
	mini = document.getElementById("mini-view");

	//content.innerHTML = full.innerHTML;
	
	$("#content-box").draggable({"handle":"h1.title"});				
	$("#content-box").mouseenter(function(){
        clearInterval(hiddeMainContentBoxInt);
        if(($("#full-view .content").css('display') == 'none') )
        {
	       $("#full-view .content").slideToggle();
        }
	});
    $("#content-box").mouseleave(function(){
        clearInterval(hiddeMainContentBoxInt);
        hiddeMainContentBoxInt = setInterval("hiddeMainContentBox()", 500);
	});
});



function showFullView()
{
	if (isClick)
	{
		//content.innerHTML = full.innerHTML;	
		//$(content).css({"width":"458px"});
		$(mini).css({"display":"none"});
		$(full).css({"display":"block"});
		
	}
}

function showMiniView()
{
	
	if (isClick)
	{
		$("#full-view .content").slideToggle(function(){
			if ($("#close-full-btn img").attr("src") == more_pic)
			{
				$("#close-full-btn img").attr("src",less_pic);
			}
			else
			{
				$("#close-full-btn img").attr("src",more_pic);
			}
		});
	}
}		


function checkIsClick()
{
	isClick = true;
	interval = setTimeout("clearClickFlag()",delay);
}
function clearClickFlag()
{
	isClick = false;
}
