//Global variables declaration


//Template variable to A,B,C,D to handle Home (A), subtemplate (B,C,D)

if (Template=="A") { 
var LeftMost=0; var WorkAreaWIDTH=743; var WorkAreaHEIGHT=752; var thecolor = "#FF6699"; var ClipperWidth=407;
}
else{
var LeftMost=0; var WorkAreaWIDTH=743; var WorkAreaHEIGHT=529; var thecolor = "#FF6699"; var thecolor2 = "#FFFFFF"; var ClipperWidth=414;
}


//document.all (IE), 
//document.layers (Netscape 4.x) 
//document.getElementById (Netscape 6+, IE 5+ and all standards compliant browsers). 

//you can say this in conditional statements or use conditional operator(?:)
//var ie, nn4, dom
//if(document.all){ie = true else{ie = false}

var nn4 = (document.layers) ? true : false 
var ie = (document.all) ? true : false 
var dom = (document.getElementById && !document.all) ? true : false

function browser(id){
  if(nn4) {
  path = document.layers[id]
  }
  else if(ie) {
  path = document.all[id]
  } 
  else {
  path = document.getElementById(id)
  }
return path  //return the path to the css layer depending on which browser is looking at the page
}

function startAgain(id,x,y){
layer = browser(id)
	if(nn4){
	layer.left = x
	layer.top = y
	}
	else{
	layer.style.left = x
	layer.style.top = y
	}		
}

function startAgain2(id,x,y,myWidth){
layer = browser(id)

	if(nn4){
		layer.left = x
		layer.top = y
		//document.layers[id].clip = rect(0px 407px 150px 0px);
		//  document.layers['DIVname'].top = 0;
		//layer.clip = rect(0px 407px 150px 0px);
		if (layer.clip.width != ClipperWidth){
			if (document.width > myWidth) { 
				//scrollbars will be visible...so don't reload or it keeps reloading
				//****************for test purposes
				//window.alert('Horizontal Scroll TRUE myWidth='+myWidth); 
				//****************for test purposes
				window.alert('Resize your netscape window OR increase your screen resolution to view all the text content')
			}
			else { 
				//scrollbars will be visible...so reload
				//****************for test purposes
				//window.alert('Horizontal Scroll FALSE myWidth='+myWidth);
				//****************for test purposes 
				//reload page if ns4 and the nested layer container is not the proper width
				if(myWidth > parseInt(document.width+10)) {				
					location.reload();
				}
				else {
					if(layer.clip.width >= parseInt(ClipperWidth-4)){
						//***For test*** window.alert('done')
					}
					else{
					//***For test*** window.alert('layerclip='+layer.clip.width);
					window.alert('Refresh or Reload your netscape window to view all the text content');}
				}
			}
		}
		else{}		
	}
	else{
		layer.style.left = x
		layer.style.top = y
	}		
}

//onload the Mask layer is set to white/background and then once everything is in postion it reveals everything

function finishMask(id,WhatNum,color){
layer = browser(id)
	if(nn4){
		layer.zIndex = parseInt(WhatNum);
		//layer.background.src = ''; 
		layer.bgColor = color; 
	}	
	else{
		layer.style.zIndex = parseInt(WhatNum);
		layer.style.background = ''; 
		layer.style.backgroundColor = color; 
	}	
}


function alertSize() {


//declare all variables

var myWidth = 0;  var myHeight = 0; var vScroll = 0; var hScroll = 0; var Mov = 0; var scrollbarLen=0; var realWidth=0;

//*****determine scroll length*****


//ns4
if (ns4) {
vScroll = document.height 
hScroll = document.width 
}

// mac ie 5
else if (mac&&ie5) {
vScroll = document.body.offsetHeight 
}

// opera 5/6/7 code
else if (op5||op6||op7) {
vScroll = WorkAreaHEIGHT
}


// ie 4+/mozilla/netscape 6/7
else if (win&&(ie5||ie6||ns6||ns7))  {
vScroll = document.body.scrollHeight
}

// ie 4
else if (win&&ie4)  {
vScroll = parseInt(document.body.scrollHeight-4);
}
else{
vScroll =WorkAreaHEIGHT
}
//*****determine scroll length*****

//*****determine ONRESIZE available width and height values*****

  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
//*****determine ONRESIZE available width and height values*****


//*****determine shift area*****


//if visible area is greater than scrollable length then "scrollbars=True"
//FOR TEST PURPOSES***** alert('myHeight:'+myHeight+' < vScroll: '+vScroll);
if (myHeight < vScroll) {

//ns4,ns6,ns7||Op6,7 include scrollbars with myWidth

if (ns4||ns6||ns7||op5||op6||op7) {scrollbarLen=15;}
else {scrollbarLen=0;}

}

//realWidth takes into account scrollbars

realWidth=parseInt(myWidth+scrollbarLen);

//if browser content window is greater than the length of content width then reposition

if (realWidth > WorkAreaWIDTH) {

//leftpos+'parseInt(myWidth-layerWidth-scrollbar)/2)'

Mov=LeftMost+parseInt((myWidth-WorkAreaWIDTH-scrollbarLen)/2);}
else {
//don't center document
Mov=0;}

//avoid being unable to calculate x shift
if (Mov > 0) {Mov=Mov;}
else {Mov=0;}

//Template variable to A,B,C,D to handle Home (A), subtemplate (B,C,D)

if (Template=="A") {

//center WorkArea

startAgain('MaskShift',parseInt(0+Mov),0);
startAgain('YogaVibeLogo',parseInt(34+Mov),25);
startAgain('YogasanasLogo',parseInt(521+Mov),33);
startAgain('YogaAsana',parseInt(440+Mov),96);
startAgain('NavigationMenu',parseInt(38+Mov),97);
startAgain('Message',parseInt(306+Mov),265);
startAgain('example',parseInt(38+Mov),382);
startAgain('SplashYogaPhoto',parseInt(0+Mov),441);
startAgain('SplashText',parseInt(217+Mov),441);
startAgain('YogaPhilosophy',parseInt(0+Mov),671);

//special for nested layer

startAgain2('p7scroller1',parseInt(260+Mov),438,myWidth);

//finish masking the shift when loading by dropping the zIndex and bgcolor of the Mask layer
//finishMask('MaskShift',1,'#FF6699');

finishMask('MaskShift',1,thecolor);

//onload/resize set focus on the email field
if (document.layers) {document.layers['example'].document.form['email'].focus();} 
else {document.form.email.focus()};

}

else{
//center WorkArea

startAgain('MaskShift',parseInt(0+Mov),0);
startAgain('YogaVibeLogo',parseInt(34+Mov),25);
startAgain('TopBorder',parseInt(3+Mov),102);
startAgain('LeftBorder',parseInt(3+Mov),105);
startAgain('Printer',parseInt(314+Mov),112);
startAgain('ScrollHere',parseInt(587+Mov),112);
startAgain('p7sc1Up',parseInt(702+Mov),105);
startAgain('RightBorder',parseInt(737+Mov),105);
startAgain('p7sc1Down',parseInt(702+Mov),120);
startAgain('Photo',parseInt(34+Mov),135);
startAgain('Title',parseInt(307+Mov),394);
startAgain('BottomBorder',parseInt(3+Mov),424);
startAgain('Bottom-White',parseInt(0+Mov),427);

//Template variable to A,B,C,D to handle Home (A), subtemplate (B,C,D)

	if (Template=="C") {

		//also include navigation bar with scrollcontent
		startAgain('NavigationBar',parseInt(307+Mov),135);

		//special for nested layer template C
		startAgain2('p7scroller1',parseInt(307+Mov),178,myWidth);
	}
	else {

		//special for nested layer template B

		startAgain2('p7scroller1',parseInt(307+Mov),135,myWidth);
	}

//finish masking the shift when loading by dropping the zIndex and bgcolor of the Mask layer and border
//finishMask('MaskShift',1,'#FF6699');

finishMask('MaskShift',1,thecolor2);
finishMask('TopBorder',3,thecolor);
finishMask('LeftBorder',3,thecolor);
finishMask('RightBorder',3,thecolor);
finishMask('BottomBorder',3,thecolor);
	}
}