// JavaScript Document
//var movieName = "testcommand";
function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
  }	else {
    return document[movieName]
  }
}

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
  if (typeof(theMovie) != "undefined") {
    return theMovie.PercentLoaded() == 100;
  } else {
    return false;
  }
}

function toggleBox(szDivID, iState) { // 1 visible, 0 hidden
   var obj = document.layers ? document.layers[szDivID] :
   document.getElementById ?  document.getElementById(szDivID).style :
   document.all[szDivID].style;
   //obj.visibility = document.layers ? (iState ? "show" : "hide") : (iState ? "visible" : "hidden");
   obj.display = iState ? "block" : "none";
  
}

function toggleBoxB(szDivID, iState) { // 1 visible, 0 hidden
   var obj = document.layers ? document.layers[szDivID] :
   document.getElementById ?  document.getElementById(szDivID).style :
   document.all[szDivID].style;
   //obj.visibility = document.layers ? (iState ? "show" : "hide") : (iState ? "visible" : "hidden");
   obj.visibility = iState ? "visible" : "hidden";
}

function toggleBox2(szDivID, iState) {// 1 visible, 0 hidden
   var obj = document.layers ? document.layers[szDivID] :
   document.getElementById ?  document.getElementById(szDivID).style :
   document.all[szDivID].style;
   obj.visibility = document.layers ? (iState ? "show" : "hide") : (iState ? "visible" : "hidden");
   if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).Rewind() 
    thisMovie(movieName).Play();
  }
}

function BrowserCheck() {
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b

	this.v = parseInt(navigator.appVersion)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0)
	this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0)
	if (this.ie5) this.v = 5
	this.min = (this.ns||this.ie)
}

// automatically create the "is" object

is = new BrowserCheck()

function css(id,left,top,width,height,color,vis,z,other) {
	if (id=="START") return '<STYLE TYPE="text/css">\n'
	else if (id=="END") return '</STYLE>'
	
	var str = (left!=null && top!=null)? '#'+id+' {position:absolute; left:'+left+'px; top:'+top+'px;' : '#'+id+' {position:relative;'

	if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'

	if (arguments.length>=5 && height!=null) {

		str += ' height:'+height+'px;'

		if (arguments.length<9 || other.indexOf('clip')==-1) str += ' clip:rect(0px '+width+'px '+height+'px 0px);'

	}

	if (arguments.length>=6 && color!=null) str += (document.layers)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'

	if (arguments.length>=7 && vis!=null) str += ' visibility:'+vis+';'

	if (arguments.length>=8 && z!=null) str += ' z-index:'+z+';'

	if (arguments.length==9 && other!=null) str += ' '+other

	str += '}\n'

	return str

}

function writeCSS(str,showAlert) {

	str = css('START')+str+css('END')

	document.write(str)

	if (showAlert) alert(str)

}

function findWH() {
	winW = (is.ns)? window.innerWidth : document.body.offsetWidth-20;
	winH = (is.ns)? window.innerHeight : document.body.offsetHeight-4;
}

function makeLiquid() {

	if ((is.ns && (winW!=window.innerWidth || winH!=window.innerHeight)) || is.ie)

	history.go(0)

}
