// What link in menu that is active from start/reload (img-name)
active_link = 'Start';
running = false;
var Timer1 ='';
//Page is requested from a LAN in store, not from internet
if(txtStore == "TRUE")
{
	// Start inactivity timer to 300000 milliseconds.
	// Reload content fram (MoviesHome.aspx) if inactive
	function post_action()
	{
		if(parent.content.location.href != txtReloadLink)
		{
			parent.window.location.reload();
		}
	}
	
	var tid, time, action;
	
	function setInactivityTimer (time, action, repeat) 
	{
		window.time = time;
		window.action = action;
		window.repeat = repeat;
		
		if (tid) 
			clearTimeout(tid);
			
		if (document.layers)
			document.captureEvents(Event.MOUSEMOVE);
			
		document.onmousemove = function (evt) {
			setInactivityTimer(window.time, window.action, window.repeat);
			return true;};
			
		if (repeat)
			action += '; setInactivityTimer(' + time + ', "' + action + '", ' + repeat + ');';
		else 
			action += '; clearEvents();';
		
		tid = setTimeout(action, time);
	}

	function clearEvents() 
	{
		if (document.layers)
			document.releaseEvents(Event.MOUSEMOVE);
	
		document.onmousemove = null;
	}
//15min
	setInactivityTimer(900000, 'post_action();', true); /**/
}
 		
// Changes category-image back when mouse-out
function MM_swapImgRestore(e) 
{ //v3.0	
	var srcEl = e.src;
	if (running == false)
	{
		running = true;
		try
		{
			if(srcEl.indexOf("_on")>-1 && srcEl.indexOf(active_link) < 0)
			{
				e.src=srcEl.replace("_on","_off");
			}
		}
		catch(er) {}
		
		running = false;
	}
			
}

// Changes category-image when mouse-on
function MM_swapImage(e) 
{ //v3.0
var srcEl = e.src; 
	if (running == false)
	{
		running = true;
		try
		{
		if(srcEl.indexOf("_on")<0)
		{
			//event.srcElement.src=event.srcElement.src.substr(0,event.srcElement.src.length-4)+'_on.gif';}
			e.src=srcEl.replace("_off","_on");
		}
		}
		catch(er) {}
		running = false;
	}
}

//Set all category images to default picture
function RestoreAll(act_link) 
{ //v3.0
	if (running == false)
	{
		running = true;
		active_link = act_link;
		
		try
		{
		for(var i = 0; i < document.images.length; i++)
		{
			if(document.images[i].src.indexOf("_on") > -1 && document.images[i].src.indexOf(active_link) < 0)
			{
				document.images.item(i).src=document.images.item(i).src.replace("_on","_off");
			}
		}
		}
		catch(e) {}
		running = false;
	}
}

function OpenWin(link_url)
{
	top.content.location.href = link_url;
	return true;
}

// Send new information to content-fram (movies.aspx) to update this page with
// new movie infom based on which category user clicked
function OpenMovies(StoreGroup, StoreID)
{
	if(top.document.body.offsetWidth>890)
	{
		if(top.document.body.offsetHeight<560)
		{
			parent.location.href="index2.aspx?colwidth=3&frm=" + (top.document.body.offsetHeight-190) + "&StoreGroup=" + StoreGroup + "&StoreID=" + StoreID + txtStoreLocal;
		}
		else
		{
			parent.location.href="index2.aspx?colwidth=3&StoreGroup=" + StoreGroup + "&StoreID=" + StoreID + txtStoreLocal;
		}			
	}
	else
	{
		if(top.document.body.offsetHeight<560)
		{
			parent.location.href="index2.aspx?frm=" + (top.document.body.offsetHeight-190) + "&StoreGroup=" + StoreGroup + "&StoreID=" + StoreID + txtStoreLocal;
		}
		else
		{
			parent.location.href="index2.aspx?StoreGroup=" + StoreGroup + "&StoreID=" + StoreID + txtStoreLocal;
		}			
	}
}

function showBlurDiv()
{
	document.getElementById("blurDivTop").style.visibility="visible"
}

function hideBlurDiv()
{
	if (document.getElementById("blurDivTop").style.visibility=="visible")
	document.getElementById("blurDivTop").style.visibility="hidden";
	parent.top.content.document.onkeypress = resetTimer;
	parent.top.content.document.onmousemove = resetTimer;
	parent.top.t_frame.document.onkeypress = resetTimer;
	parent.top.t_frame.document.onmousemove = resetTimer;
	
	Timer1 = setTimeout("reloadPage()", 900000);

	
}


function resetTimer()
{
	clearTimeout(Timer1);
//15 min
	Timer1=setTimeout('reloadPage()', 900000);
	
	
}
function reloadPage()
{
	window.clearTimeout(Timer1); 
	parent.window.location.reload();
}



