////////////////////////////////
// JavaScript Main Document   //
// Constructed by Code d'Azur //
// Version 0.1                //
////////////////////////////////
function getClientWidth()
{
	var clientW;
	if (self.innerWidth)
	{
		clientW = self.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth)
	{
		clientW = document.documentElement.clientWidth;
	} else if (document.body)
	{
		clientW = document.body.clientWidth;
	}
	return clientW;
}

function getClientHeight()
{
	var clientH;
	if (self.innerHeight)
	{
		clientH = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight)
	{
		clientH = document.documentElement.clientHeight;
	} else if (document.body)
	{
		clientH = document.body.clientHeight;
	}
	return clientH;
}

function getScrollTop()
{
	var scrollT;
	if (self.pageYOffset)
	{
		scrollT = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop)
	{
		scrollT = document.documentElement.scrollTop;
	} else if (document.body)
	{
		scrollT = document.body.scrollTop;
	}
	return scrollT;
}

function setScrollTop()
{
	self.scrollTo(0,0);
}

function setScrollBottom()
{
	self.scrollTo(0,3000);
}

function setScrollPos(numPos)
{
	self.scrollTo(0,numPos);
}

function setDivHeight(numHeight)
{
	var userAgent = navigator.userAgent.toLowerCase();
	//if (userAgent.indexOf("mac") == -1)
	//{
		document.getElementById("flashcontent").style.height = numHeight+"px";
	//}
	//document.getElementById("flashcontent").style.height = numHeight;
	getScreenCoords();
}

function getScreenCoords()
{
	var screenTopY    = getScrollTop();
	var screenBottomY = getClientHeight();
	//document.flashcontent.SetVariable("strScreenTopY", screenTopY);
	//document.flashcontent.SetVariable("strScreenBottomY", screenBottomY);
	//document.flashcontent.SetVariable("strScreenCoordsLoaded", "true");
}

function handleWindowChange()
{
	getScreenCoords();
}

function doBookmark()
{
	var appName   = navigator.appName.toLowerCase(); 
	var userAgent = navigator.userAgent.toLowerCase();
	if (appName.indexOf("explorer") != -1)
	{
		window.external.AddFavorite(parent.window.location, parent.document.title);
	} else {
		var info;
		if (userAgent.indexOf("mac") != -1)
		{
			info = "Please use Cmd-D or the menu to bookmark Sanex site";
		} else {
			info = "Please use Ctrl-D or the menu to bookmark Sanex site";
		}
		alert(info);		
	}
}

window.onresize = handleWindowChange;
window.onscroll = handleWindowChange;

// open window met scrollbars
function openwindow(wurl,wname,wwidth,wheight)
{
  var width 	  = wwidth;
  var height	  = wheight;
  var url         = wurl;
  var name        = wname;
  var str = "height="+height+",innerHeight="+height+",width="+width+",innerWidth="+width+",scrollbars=no";
  if(window.screen)
  {
	var xc = (screen.width - wwidth) / 2;
	var yc = (screen.height - wheight) / 2;
	str += ",left="+xc+",screenX="+ xc+",top="+yc+",screenY="+yc;
  } 
  wwindow=window.open(url, name, str);
}
// open window met scrollbars
function openwindow2(wurl,wname,wwidth,wheight)
{
  var width 	  = wwidth;
  var height	  = wheight;
  var url         = wurl;
  var name        = wname;
  var str = "height="+height+",innerHeight="+height+",width="+width+",innerWidth="+width+",scrollbars=yes";
  if(window.screen)
  {
	var xc = 0
	var yc = 0
	str += ",left="+xc+",screenX="+ xc+",top="+yc+",screenY="+yc;
  } 
  wwindow=window.open(url, name, str);
}