// JavaScript Document

function ShowIf(elmId, value, valueIfshow)
{	
	if(value == valueIfshow)
	{
		document.getElementById(elmId).style.display = 'block';	
	}
	else
	{
		document.getElementById(elmId).style.display = 'none';
	}
}

function showHide(id)
{	
	if (document.getElementById(id).style.display == 'none')
	{
		document.getElementById(id).style.display = 'block';
		/*var divBox = document.getElementById(id); 
		scrollTo(divBox.offsetLeft, divBox.offsetTop);*/ /*scrollar till boxen*/
	}
	else
	{
		document.getElementById(id).style.display = 'none';	
	}
}

function OnScrollHeight()
{
	screenHeight = screen.height;
	
	wrapperHeight = document.getElementById("wrapper").offsetHeight;
	
	document.getElementById("popup_main").style.height = wrapperHeight + "px"; /*Toning*/
}

function popupShowHide(id)
{	
	if (document.getElementById(id).style.display == 'none')
	{
		topMargin = 125; /* lägg in i default.css om ändras*/
		
		document.getElementById(id).style.display = 'block';
		
		if(document.getElementById("popup_main").style.display == 'block') /*Finns redan en pupup, högre z-index*/
		{
			document.getElementById(id).style.zIndex = '202';	
		}
		
		wrapperHeight = document.getElementById("wrapper").offsetHeight;
		popupHeight = document.getElementById(id).offsetHeight + topMargin;
		/*screenHeight = screen.height;*/
				
		if(wrapperHeight > popupHeight) /*Sida längre än popup (normalt) */
		{ 
			document.getElementById("popup_main").style.height = wrapperHeight + "px";  /*Toning*/
		}
		else /* Väldigt lång popup*/
		{			
			document.getElementById("popup_main").style.height = popupHeight + "px";  /*Toning*/
		}
				
		document.getElementById("popup_main").style.display = 'block';
		
		var divBox = document.getElementById(id); 
		scrollTo(divBox.offsetLeft, divBox.offsetTop); /*scrollar till boxen*/
		
	}
	else
	{
		document.getElementById(id).style.display = 'none';	
		
		if(document.getElementById(id).style.zIndex < 202) /*Finns mindre än två en pupup, tar bort toning*/
		{
			document.getElementById("popup_main").style.display = 'none'; /*Omslutande div, tonar sidan*/	
		}	
	}
}

function hidePopupCookie(group)
{
	
	
	if(document.getElementById("no_show_check").checked == true)
	{
		expiredays = 200;
	}
	else
	{
		expiredays = -201;
	}
	
	name = "no_show_group_" + escape(group);
	value = 1;
	
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());

}
/*added on 01-01-09 for Nested gridview Collaps and expand*/
//function expandcollapse(obj, row) 
//{
////debugger ;
//	var div = document.getElementById(obj);
//	var img = document.getElementById('img' + obj);
//if(document.getElementById(obj)!=null )
//{
//	if (div.style.display == "none") 
//	{
//		div.style.display = "block";
//		if (row == 'alt') 
//		{
//			img.src = "_images/minus.gif";
//		}
//		else 
//		{
//			img.src = "_images/minus.gif";
//		}
//		img.alt = "Close to view other Customers";
//	
//	}
//	else 
//	{
//		div.style.display = "none";
//		if (row == 'alt')
//		 {
//			img.src = "_images/plus.gif";
//		}
//		else 
//		{
//			img.src = "_images/plus.gif";
//		}
//		img.alt = "Expand to show Orders";
//	}
//	}
//} 

