// JavaScript Document

function AllHLImagesPreload() {
      MM_preloadImages("images/Home_Box1_Img2HL.gif","images/Home_Box1_Img1HL.gif","images/Home_Bttn_MoreHL.gif","images/Subnav_ProductCatalogueHL.jpg","images/Subnav_StoreLocatorHL.jpg","images/Subnav_RetailersHL.jpg","images/Subnav_ScrapbookingHL.jpg","images/Subnav_ForTheClassroomHL.jpg","images/Subnav_AboutSandylionHL.jpg","images/FooterNav_CoppaHL.jpg","images/FooterNav_termsConditionsHL.jpg","images/FooterNav_PrivacyHL.jpg","images/FooterNav_CorporateHL.jpg","images/FooterNav_ContactHL.jpg","images/startButton.png","images/StartButtHL.png","images/Close.png","images/CloseHL.png","images/WhatsNew.png","images/WhatsNewHL.png","images/Games.png","images/GamesHL.png","images/Activities.png","images/ActivitiesHL.png","images/pop_grayout.png","images/PopWin11.png","images/PopWin21.png","images/PopWin31.png","images/PopWin12.png","images/PopWin32.png","images/PopWin13.png","images/PopWin23.png","images/PopWin33.png")
}
							

function gotoPage(pageURL) {
	document.location.href=pageURL
}

  function closePopUpWin() {
	 document.getElementById("popUpImage").innerHTML="&nbsp;" 
	 try { document.getElementById("myFrame").src="" } catch(ex) {};
     document.getElementById("GrayOutTbl").style.visibility="hidden" 
     document.getElementById("popUpWin").style.visibility="hidden"
  }
  
  function openPopUpWinImg(imageSrc,Text,W,H,borderSize) {

    var posleft;
    var postop;
    var wdth=W;
    var hgh=H;
    if (navigator.appName.indexOf("Internet Explorer")!=-1) {
       var scPos=new Array(0,0)
       scPos=getScrollXY()
       posleft = scPos[0] + ((document.documentElement.clientWidth - wdth-borderSize) / 2)
       postop = scPos[1] + ((document.documentElement.clientHeight - hgh-borderSize) / 2)
    } else {
       posleft = window.pageXOffset + ((window.innerWidth - wdth-borderSize) / 2)
       postop = window.pageYOffset + ((window.innerHeight - hgh-borderSize) / 2)
    }
    if (posleft<10 ) posleft=10
    if (postop<90 ) postop=90


     var wh=getWindowHeight()	
     var ww=getWindowWidth()
	 if (ww<744) ww=744 // This is due to the bug in FF
     document.getElementById("GrayOutTbl").style.height=(wh+100) + "px"
     document.getElementById("GrayOutTbl").style.width=(ww+100) + "px"
     document.getElementById("GrayOutTbl").style.visibility="visible" 
     document.getElementById("popUpText").innerHTML= Text
	 if (W>0) {
	    document.getElementById("popUpImage").innerHTML="<img border='0' src='"+imageSrc+"' width='" + W + "' height='" + H + "'  style='border: solid " + borderSize + "px  #CCCCCC'/>"
	 } else {
	    document.getElementById("popUpImage").innerHTML="<img border='0' src='"+imageSrc+"' style='border: solid " + borderSize + "px  #CCCCCC'/>"
	 }
     document.getElementById("popUpWin").style.top=postop + 'px'
     document.getElementById("popUpWin").style.left=posleft + 'px'
     document.getElementById("popUpWin").style.visibility="visible"  
  }

  function openPopUpWin(URL,Text,W,H,Style,Scroll) {
    var posleft;
    var postop;
    var wdth=W;
    var hgh=H;
    if (navigator.appName.indexOf("Internet Explorer")!=-1) {
       var scPos=new Array(0,0)
       scPos=getScrollXY()
       posleft = scPos[0] + ((document.documentElement.clientWidth - wdth) / 2)
       postop = scPos[1] + ((document.documentElement.clientHeight - hgh) / 2)
    } else {
       posleft = window.pageXOffset + ((window.innerWidth - wdth) / 2)
       postop = window.pageYOffset + ((window.innerHeight - hgh) / 2)
    }
    if (posleft<10 ) posleft=10
    if (postop<90 ) postop=90

     var wh=getWindowHeight()	
     var ww=getWindowWidth()
	 if (ww<744) ww=744 // This is due to the bug in FF
     document.getElementById("GrayOutTbl").style.height=(wh+100) + "px"
     document.getElementById("GrayOutTbl").style.width=(ww+100) + "px"
     document.getElementById("GrayOutTbl").style.visibility="visible" 
     document.getElementById("popUpText").innerHTML= Text
	 if (Scroll==1) {
        document.getElementById("popUpImage").innerHTML="<iframe id='myFrame' height='" + H + "'   width='" + W + "' frameborder='0' scrolling='auto' src='"+URL+"' style='"+Style+"'></iframe>"
	 } else {
        document.getElementById("popUpImage").innerHTML="<iframe id='myFrame' height='" + H + "'   width='" + W + "' frameborder='0' scrolling='no' src='"+URL+"' style='"+Style+"'></iframe>"
	 }
     document.getElementById("popUpWin").style.top=postop + 'px'
     document.getElementById("popUpWin").style.left=posleft + 'px'
     document.getElementById("popUpWin").style.visibility="visible"  
	 
  }


function getWindowHeight () {
	var windowHeight;
    if(navigator.appName.indexOf("Internet Explorer")!=-1) {
		windowHeight=screen.availHeight
	} else {
		windowHeight=window.innerHeight
	}	
    if (document.body.scrollHeight>windowHeight) {
		return document.body.scrollHeight
	} else {
		return windowHeight
	}
}

function getWindowWidth () {
	var windowWidth;
    if(navigator.appName.indexOf("Internet Explorer")!=-1) {
		windowWidth=screen.availWidth
	} else {
		windowWidth=window.innerWidth
	}	
    if (document.body.scrollWidth>windowWidth) {
		return document.body.scrollWidth
	} else {
		return windowWidth
	}
}

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}
