function sendCatId(cat, isExpanded){
	document.getElementById('tarCat').value = cat;
	document.getElementById('isExpanded').value = isExpanded;
	document.forms[0].submit();
}
	
function CallPage(page, catid)
{
	window.top.frames('main').location.href = page + "?cat=" + catid;
}

function UpdateCartInfo()
{
	if (navigator.userAgent.indexOf("Opera") != -1)
	{
		if( parent.frames['cart'] != null)
		{	
			var newURL = location.protocol + '//' + location.host + location.pathname.substring(0,location.pathname.lastIndexOf('/')) + '/cart.aspx';
	
			parent.frames['cart'].location.replace(newURL);
		}
	}
	else if (navigator.userAgent.indexOf("IE") != -1)
	{
		if( parent.frames['cart'] != null)
		{			
			parent.frames['cart'].location.replace("cart.aspx");
		}
	}
	else if (navigator.userAgent.indexOf("Mozilla") != -1)
	{
		if( parent.frames['cart'] != null)
		{			
			parent.frames['cart'].location.replace("cart.aspx");
		}
	}	
}

function UpdateCartAfterAdd()
{
	if( window.top.frames['cart'] != null)
	{	
		//window.top.frames['cart'].location.replace("cart.aspx?reload=" + new Date());
	}
}

function Dummy()
{
}

function redirect()
{
	top.window.location.href = "default.aspx";
}

function ShowSub(id)
{
   hideAllSubLayer();

	if ( eval(doc + "." + gebiStart + "Sub"+ id + "") != null )
	{
		eval(doc + "." + gebiStart + "Sub"+ id + gebiEnd + css +".visibility = '"+ actionWordShow +"'");
	}
	else
	{
		parent.main.location.href="main.aspx?catid=" + id
	}
}

  

function hideAllSubLayer()
{
	var antal = document.getElementsByTagName('div');

	for(var i=0; i<antal.length; i++)
    {
		eval("antal["+ i +"]" + css + ".visibility = '"+ actionWordHide +"'");
	}
}


function search(searchWord, alertText)
{
		
	var searchWord = document.forms[0].txtSearch.value;
			
    if (searchWord.length>2)
    {
		openWinSearchWin("searchFrames.asp?searchWord=" + escape(searchWord), 255,300);
	}
    else
    {
		alert("Your search has to include at least three letters.");
    }
}
function openWin(url, width, height) {
	newWin=window.open(url,'', 'menubar=no,resizable=no,width=' + width + ',height=' + height + ',titlebar=no,alwaysRaised=yes,status=no,scrollbars=no,left='+(screen.width/2-width/2)+',top='+(screen.height/2-height/2-height/10)+',screenX=0,screenY=0');
	return newWin
}

function openWinScroll(url,width,height) {
	newWin=window.open(url,'popWin','menubar=no,resizable=no,width=' + width + ',height=' + height + ',titlebar=no,alwaysRaised=yes,status=no,scrollbars=yes,left='+(screen.width/2-width/2)+',top='+(screen.height/2-height/2-height/10)+',screenX=0,screenY=0');
	return newWin
}

function DoSearch(searchPage, tbSearch, alertText){
	var sSearch = document.getElementById(tbSearch).value;
	if( sSearch.length > 2 )
	{
		var encodedInputString = escape(sSearch);
		encodedInputString = encodedInputString.replace("+", "%2B");
		encodedInputString = encodedInputString.replace("/", "%2F"); 
		
		parent.main.location.href = searchPage + "?searchstring=" + encodedInputString;
	}else{
		alert(alertText);
	}
}

function OnEnter(searchPage, tbSearch, alertText, event){
	
	if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13))
	{
		event.returnValue = false;
		event.cancel = true;
		DoSearch(searchPage, tbSearch, alertText)
	}
}

function DoSearchStart(searchPage, tbSearch, alertText){
	var sSearch = document.getElementById(tbSearch).value;
	if( sSearch.length > 2 )
	{
		//alert(sSearch);
		parent.location.href = searchPage + "?searchstring=" + sSearch
	}else{
		alert(alertText)
	}
}

function OnEnterStart(searchPage, tbSearch, alertText, event){
	
	if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13))
	{
		event.returnValue = false;
		event.cancel = true;
		DoSearchStart(searchPage, tbSearch, alertText)
	}
}

function resizeDiv()
{
	if(document.body.scrollHeight < document.body.clientHeight)
	{
		document.getElementById('searchDiv').style.width="155px";
	}
	else
	{
		document.getElementById('searchDiv').style.width="138px";
	}
}

function scrollIt(xVal, yVal){
	if(xVal == null)
	{
		window.scrollTo(document.forms[0].PageX.value, document.forms[0].PageY.value);
	}else{
		window.scrollTo(document.getElementById(xVal).value, document.getElementById(yVal).value);
	}
}
function setCoords(xVal, yVal){
	var myPageX;
	var myPageY;
	if (document.all){
		myPageX = document.body.scrollLeft;
		myPageY = document.body.scrollTop;
		}
	else{
		myPageX = window.pageXOffset;
		myPageY = window.pageYOffset;
		}
	if(xVal == null)
	{
		document.forms[0].PageX.value = myPageX;
		document.forms[0].PageY.value = myPageY;
	}
	else
	{	
		document.getElementById(xVal).value = myPageX;
		document.getElementById(yVal).value = myPageY;
	}
}