var has_inner = typeof(window.innerWidth) == 'number';
var has_element = document.documentElement && document.documentElement.clientWidth;

function getWidth()
{
       var widthOver;
       if (self.innerWidth) // all except Explorer
       {
               widthOver =  self.innerWidth;
       }
       else if (document.documentElement && document.documentElement.clientWidth)
               // Explorer 6 Strict Mode
       {
               widthOver =  document.documentElement.clientWidth;
       }
       else if (document.body) // other Explorers
       {
               widthOver =  document.body.clientWidth;
       }
       return widthOver;
}

function getHeight()
{
       var heightOver;
       if (self.innerHeight) // all except Explorer
       {
               heightOver =  self.innerHeight;
       }
       else if (document.documentElement && document.documentElement.clientHeight)
               // Explorer 6 Strict Mode
       {
               heightOver =  document.documentElement.clientHeight;
       }
       else if (document.body) // other Explorers
       {
               heightOver =  document.body.clientHeight;
       }
       return heightOver;
}
function testf(){
alert('working');
}
function showOverlay(){
       var Wval;
       var Hval;
       Hval = document.documentElement.scrollHeight;
       Wval = document.documentElement.scrollWidth;
       var overDiv = document.getElementById("overlay");
			
       overDiv.style.top = "0";
       overDiv.style.left = "0";
       overDiv.style.width=Wval + "px";
       overDiv.style.height=Hval + "px";
       //alert("width=" + overDiv.style.width + "height=" + overDiv.style.height);
       overDiv.style.display="block";
			 center_box(700,500);
       
}

function hideOverlay(){
       var overDiv = document.getElementById("overlay");
       var productDiv = document.getElementById("cesarOver");
       overDiv.style.display="none";
       productDiv.style.display="none";
}

function showOverlay_reg(){
       var Wval;
       var Hval;
       Hval = document.documentElement.scrollHeight;
       Wval = document.documentElement.scrollWidth;
       var overDiv = document.getElementById("overlay_reg");
			
       overDiv.style.top = "0";
       overDiv.style.left = "0"
       overDiv.style.width=Wval + "px";
       overDiv.style.height=Hval + "px";
       //alert("width=" + overDiv.style.width + "height=" + overDiv.style.height);
       overDiv.style.display="block";
			 lbox_reg(700,500);
       
}

function hideOverlay_reg(){
       var overDiv = document.getElementById("overlay_reg");
       var productDiv = document.getElementById("cesarOver_reg");
       overDiv.style.display="none";
       productDiv.style.display="none";
}

function center_box(width, height)
{
   var productDiv = document.getElementById("cesarOver");
               cleft = has_inner
       ? pageXOffset + window.innerWidth
       : has_element
         ? document.documentElement.scrollLeft +
           document.documentElement.clientWidth
         : document.body.scrollLeft +
           document.body.clientWidth;

   cleft = (cleft - width)/2;

   ctop = has_inner
       ? pageYOffset + window.innerHeight
       : has_element
         ? document.documentElement.scrollTop +
           document.documentElement.clientHeight
         : document.body.scrollTop +
           document.body.clientHeight;

   ctop = (ctop - height)/2;

   productDiv.style.left = cleft + 'px';
   productDiv.style.top = ctop + 'px';
               productDiv.style.width=width + "px";
               productDiv.style.height=height + "px";
               productDiv.style.display="block";
               productDiv.innerHTML = "<img src='/imgs/overlay.jpg' width='695' height='464' border='0' usemap='#over' />\
							 <map name='over' id='over'><area shape='rect' coords='224,401,469,448' href='/registration/userprofile.aspx' alt='member' />\
							 		<area shape='rect' coords='596,428,678,454' href='#' onclick='javascript:hideOverlay();' />\
								<area shape='rect' coords='61,264,119,288' href='/lessons/puppy.aspx' alt='puppy' />\
								<area shape='rect' coords='200,264,261,288' href='/lessons/anxiety.aspx' alt='anxiety' />\
								<area shape='rect' coords='200,289,242,309' href='/lessons/fear.aspx' alt='fear' />\
								<area shape='rect' coords='61,288,140,309' href='/lessons/newdog.aspx' alt='new dog'/>\
								<area shape='rect' coords='61,309,165,331' href='/lessons/hyperactivity.aspx' alt='hyperactivity' />\
                <area shape='rect' coords='68,44,161,65' href='/course.aspx'  alt='course plan'/>\
								<area shape='rect' coords='199,311,305,335' href='/lessons/aggression.aspx' alt='aggression' />\
								<area shape='rect' coords='340,30,664,200' href='/Registration/UserProfile.aspx?productid=2' />\
								<area shape='rect' coords='340,202,666,293' href='/Registration/UserProfile.aspx?productid=4' />\
								<area shape='rect' coords='339,299,669,389' href='/Registration/UserProfile.aspx?productid=3' />\
								</map>";
}

function lbox_reg(width, height)
{
   var productDiv = document.getElementById("cesarOver_reg");
               cleft = has_inner
       ? pageXOffset + window.innerWidth
       : has_element
         ? document.documentElement.scrollLeft +
           document.documentElement.clientWidth
         : document.body.scrollLeft +
           document.body.clientWidth;

   cleft = (cleft - width)/2;

   ctop = has_inner
       ? pageYOffset + window.innerHeight
       : has_element
         ? document.documentElement.scrollTop +
           document.documentElement.clientHeight
         : document.body.scrollTop +
           document.body.clientHeight;

   ctop = (ctop - height)/2;

   productDiv.style.left = cleft + 'px';
   productDiv.style.top = ctop + 'px';
               productDiv.style.width=width + "px";
               productDiv.style.height=height + "px";
               productDiv.style.display="block";
               productDiv.innerHTML = "<img src='../imgs/overlay_reg.jpg' width='695' height='464' border='0'  usemap='#lb_reg' />\
<map name='lb_reg' id='lb_reg'>\
<area shape='rect' coords='500,429,673,454' href='#' onclick='javascript:hideOverlay_reg();' />\
</map>";
}