﻿function $(elID){
	return document.getElementById(elID);
}

function ToggleSubMenu(elID){
	if($("MNU_Menu")){
		if ($(elID).style.display=="none"){
			$(elID).style.display="block";
		}else{
			$(elID).style.display="none";
		}
	}
}
function CollapseSubMenus(){
	if($("MNU_Menu")){
		$("MNU_ShopSubMenu").style.display="none";
		$("MNU_ShareSubMenu").style.display="none";
		$("MNU_OrganizeSubMenu").style.display="none";
	}
}


function SetActiveTab(tabId){	
	if ($("Tab_MyProfile")) $("Tab_MyProfile").className="TabInactive";
	if ($("Tab_MyProjects")) $("Tab_MyProjects").className="TabInactive";
	if ($("Tab_MyAlbums")) $("Tab_MyAlbums").className="TabInactive";
	if ($("Tab_Home")) $("Tab_Home").className="TabInactive";

	switch (tabId){
		case 'MAKESTUFF':
			if ($("Make_Stuff")) $("Make_Stuff").className="TabActive";
			break;
		case 'MYCOUPONS':
			if ($("My_Coupons")) $("My_Coupons").className="TabActive";
			break;
				
		case 'MYACCOUNT':
			if ($("Tab_MyProfile")) $("Tab_MyProfile").className="TabActive";
			break;
		case 'MYPROJECTS':
			if ($("Tab_MyProjects")) $("Tab_MyProjects").className="TabActive";
			break;
		case 'MYALBUMS':
			if ($("Tab_MyAlbums")) $("Tab_MyAlbums").className="TabActive";
			break;
		case 'MYDOTPHOTO':
			if ($("Tab_Home")) $("Tab_Home").className="TabActive";
			break;
	}
	
}

function Init(){
	CollapseSubMenus();
	AdDisplayInitalize();
}

function MainOnLoad(){
	if(window.SubOnLoad){
		SubOnLoad();
	}
	if(window.SecondarySubOnLoad){
		SecondarySubOnLoad();
	}
	if(window.fillup){
	//salert("fillup")
	fillup();
	}
}

function GetPosition(theElement){
	var positionX = 0;
	var positionY = 0;

	while (theElement != null){
		positionX += theElement.offsetLeft;
		positionY += theElement.offsetTop;
		theElement = theElement.offsetParent;
	}

	return [positionX, positionY];
}

function returnDocumentName() {
var file_name = document.location.href;
var end = (file_name.indexOf("?") == -1) ? file_name.length : file_name.indexOf("?");
return file_name.substring(file_name.lastIndexOf("/")+1, end);
}
function SessionTimeOut(){
window.location = "../SessionTimeOut.asp"
}

function timedMsg(TimeOut)
{
t = setTimeout('SessionTimeOut()', TimeOut);

}
function stopCount()
{
clearTimeout(t);
}


