window.onload=function(){
			if(document.getElementById("mainMenu"))
				initializeMenu('mainMenu');
		
    		if(document.getElementById("tooltip")){
    			tipobj=document.getElementById("tooltip");
    			document.onmousemove=positiontip;
    			hidetooltip();	
    		}
    	}
    	
function openShopDE(page){
	//alert(location.hostname);
	var sUrl = page;
	//sUrl = "http://www.gudrunsjoeden.de";
		
    theShop=window.open(sUrl,'shop',"status=yes,location=yes,toolbar=yes,resizable=yes,scrollbars=yes,width=795,height=595");
    theShop.focus();
}
function openShopDE_top(page) {
    //alert(location.hostname);
    var sUrl = page;
    //sUrl = "http://www.gudrunsjoeden.de";

    theShop = window.open(sUrl, 'shop', "status=yes,location=yes,toolbar=yes,resizable=yes,scrollbars=yes,width=795,height=595");
    theShop.focus();
    document.location.replace(xURL);
}
function openShopWithPage(sPage){
	var sUrl;
	if(location.hostname == "localhost")
		sUrl = "http://localhost/gudrunsjodenhy";
	else if(location.hostname == "172.16.16.78")
		sUrl = "http://172.16.16.78/gudrunsjodenHY";
	else if (location.hostname == "194.132.117.33")
		sUrl = "http://194.132.117.33/gudrunsjodenHY";
	else if (location.hostname == "acceptans.pulsen.se")
		sUrl = "http://acceptans.pulsen.se/gudrunsjodenHY";
	else
		sUrl = "http://www.gudrunsjoden.com/butikHY";

	var nHeight;
	nHeight = 580;

	if (screen.availHeight >= 700){
		nHeight = 700;
	}

    theShop=window.open(sUrl+'/docs/webshop/'+sPage,'shop',"status=yes,location=yes,toolbar=yes,resizable=yes,scrollbars=yes,width=780,height=" + nHeight);
    theShop.focus();
}
function openMyPages(sPage){
		
	var nHeight;
	nHeight = 580;

	if (screen.availHeight >= 700){
		nHeight = 700;
	}

    theShop=window.open(sPage,'shop',"status=yes,location=yes,toolbar=yes,resizable=yes,scrollbars=yes,width=780,height=" + nHeight);
    theShop.focus();
}
function openWithPage(sPage){
	var sUrl;
	if(location.hostname == "localhost")
		sUrl = "http://localhost/gudrunsjodenhy";
	else if(location.hostname == "172.16.16.78")
		sUrl = "http://172.16.16.78/gudrunsjodenHY";
	else if (location.hostname == "194.132.117.33")
		sUrl = "http://194.132.117.33/gudrunsjodenHY";
	else if (location.hostname == "acceptans.pulsen.se")
		sUrl = "http://acceptans.pulsen.se/gudrunsjodenHY";
	else
		sUrl = "http://www.gudrunsjoden.com/butikHY";

	var nHeight;
	nHeight = 580;

	if (screen.availHeight >= 700){
		nHeight = 700;
	}

    theShop=window.open(sUrl+'/'+sPage,'shop',"status=yes,location=yes,toolbar=yes,resizable=yes,scrollbars=yes,width=780,height=" + nHeight);
    theShop.focus();
}

function openMeetingPlaceWithPage(sPage,sName,nWidth,nHeight){
    theShop=window.open(sPage,'Gudrun', "width=819, height=601, toolbar=no, status=no, scrollbars=yes, resizable=no");
    //theShop=window.open(sPage);
    theShop.focus();
}

function openMoreInfo(pageUrl){
    moreInfo=window.open(pageUrl,'moreInfo',"resizable=yes,scrollbars=yes,width=450,height=600");
    if (screen.availHeight >= 700){
		moreInfo.moveTo(screen.availWidth-794,200);
	}	
    moreInfo.focus();
}

function openTygklipp(pageUrl){
    var TygInfo=window.open(pageUrl,'tygklipp',"resizable=no,scrollbars=yes,width=625,height=330");    
    if (screen.availHeight >= 700){
		TygInfo.moveTo(screen.availWidth-994,200);
	}	
    TygInfo.focus();
}

function openPopup(pageUrl, rubrik,  bredd, hojd){
    var popup=window.open(pageUrl,rubrik,"resizable=no,scrollbars=yes,width="+bredd+",height="+hojd);
    popup.focus();
}

function changeStartPic(whichPicSrc){
    		document.getElementById('startPic').src=whichPicSrc;
    	}

/*ToolTip functions*/
var offsetxtooltip=-60 //Customize x offset of tooltip
var offsetytooltip=20 //Customize y offset of tooltip
var enabletip=false



function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function tooltip(thetext){
    if (document.getElementById("tooltip")) {
        tipobj = document.getElementById("tooltip");
        tipobj.innerHTML = thetext;
    }    
	if(thetext == '')
		enalbetip=false
	else
		enabletip=true
}

function positiontip(E){
if (enabletip){
var curX=E?E.pageX : event.x+ietruebody().scrollLeft;
var curY=E?E.pageY : event.y+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=!E? ietruebody().clientWidth-event.clientX-offsetxtooltip : window.innerWidth-E.clientX-offsetxtooltip-20
var bottomedge=!E? ietruebody().clientHeight-event.clientY-offsetytooltip : window.innerHeight-E.clientY-offsetytooltip-20

var leftedge=(offsetxtooltip<0)? offsetxtooltip*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)//move the horizontal position of the menu to the left by it's width
tipobj.style.left=!E? ietruebody().scrollLeft+event.clientX+"px" : window.pageXOffset+E.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else //position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxtooltip+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=!E? ietruebody().scrollTop+event.clientY-offsetytooltip+"px" : window.pageYOffset+E.clientY-tipobj.offsetHeight-offsetytooltip+"px"
else
tipobj.style.top=curY+offsetytooltip+"px"
tipobj.style.visibility="visible"
}
tipobj.style.visibility="visible"
}

function hidetooltip(){
enabletip=false
tipobj.style.visibility="hidden";
tipobj.innerHTML="";
tipobj.style.left="-1000px";
}

/*End tooltip functions*/

