///////////////////////////////////////////////////////////////////////
//     This script is for use in e-StudioMax websites                //
//                                                                   //
//     It contains a couple of js files writen by other people       //
//     which can be copied and used. However, the jscript            //
//     in its entirity cannot be copied and used.                    //
//                                                                   //
//     (c) e-StudioMax.com 2003. all rights reserved                 //
///////////////////////////////////////////////////////////////////////

/*
ua.js revision 0.200 2001-12-03

Contributor(s): Bob Clary, Netscape Communications, Copyright 2001

Netscape grants you a royalty free license to use, modify and
distribute this software provided that this copyright notice
appears on all copies.  This software is provided "AS IS,"
without a warranty of any kind.
*/

function xbDetectBrowser()
{
  var oldOnError = window.onerror;
  var element = null;

  window.onerror = null;

  // work around bug in xpcdom Mozilla 0.9.1
  window.saveNavigator = window.navigator;

  navigator.OS    = '';
  navigator.version  = parseFloat(navigator.appVersion);
  navigator.org    = '';
  navigator.family  = '';

  var platform;
  if (typeof(window.navigator.platform) != 'undefined')
  {
    platform = window.navigator.platform.toLowerCase();
    if (platform.indexOf('win') != -1)
      navigator.OS = 'win';
    else if (platform.indexOf('mac') != -1)
      navigator.OS = 'mac';
    else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)
      navigator.OS = 'nix';
  }

  var i = 0;
  var ua = window.navigator.userAgent.toLowerCase();

  if (ua.indexOf('opera') != -1)
  {
    i = ua.indexOf('opera');
    navigator.family  = 'opera';
    navigator.org    = 'opera';
    navigator.version  = parseFloat('0' + ua.substr(i+6), 10);
  }
  else if ((i = ua.indexOf('msie')) != -1)
  {
    navigator.org    = 'microsoft';
    navigator.version  = parseFloat('0' + ua.substr(i+5), 10);
    //alert(navigator.version)

    if (navigator.version < 4){
      navigator.family = 'ie3';
    }else{
      if (navigator.version > 5){
      	navigator.family = 'gecko';
      }else{
      	navigator.family = 'ie4';
      }
    }
  }
  else if (ua.indexOf('gecko') != -1)
  {
    navigator.family = 'gecko';
    var rvStart = navigator.userAgent.indexOf('rv:') + 3;
    var rvEnd = navigator.userAgent.indexOf(')', rvStart);
    var rv = navigator.userAgent.substring(rvStart, rvEnd);
    var decIndex = rv.indexOf('.');
    if (decIndex != -1)
    {
      rv = rv.replace(/\./g, '')
      rv = rv.substring(0, decIndex-1) + '.' + rv.substr(decIndex)
    }
    navigator.version = parseFloat(rv);

    if (ua.indexOf('netscape') != -1)
      navigator.org = 'netscape';
    else if (ua.indexOf('compuserve') != -1)
      navigator.org = 'compuserve';
    else
      navigator.org = 'mozilla';
  }
  else if ((ua.indexOf('mozilla') !=-1) && (ua.indexOf('spoofer')==-1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera')==-1)&& (ua.indexOf('webtv')==-1) && (ua.indexOf('hotjava')==-1))
  {
    var is_major = parseFloat(navigator.appVersion);

    if (is_major < 4)
      navigator.version = is_major;
    else
    {
      i = ua.lastIndexOf('/')
      navigator.version = parseFloat('0' + ua.substr(i+1), 10);
    }
    navigator.org = 'netscape';
    navigator.family = 'nn' + parseInt(navigator.appVersion);
  }
  else if ((i = ua.indexOf('aol')) != -1 )
  {
    // aol
    navigator.family  = 'aol';
    navigator.org    = 'aol';
    navigator.version  = parseFloat('0' + ua.substr(i+4), 10);
  }
  else if ((i = ua.indexOf('hotjava')) != -1 )
  {
    // hotjava
    navigator.family  = 'hotjava';
    navigator.org    = 'sun';
    navigator.version  = parseFloat(navigator.appVersion);
  }

  window.onerror = oldOnError;
}

xbDetectBrowser();

///////////////////////////////////////////////////////////////////////
//
// Preload Images
//
///////////////////////////////////////////////////////////////////////

var Woo_images = [
	"/w/images/WooLoader.gif"
  ];

  // make sure not to end the last item with comma (,)
  // otherwise IE enters the twilight zone

  for (var i = 0; i < Woo_images.length; i++) {
    var src = Woo_images[i];
    var img = new Image();
    img.src = src;
    Woo_images[i] = img;
  }


///////////////////////////////////////////////////////////////////////
//
// GET OBJECT
//
///////////////////////////////////////////////////////////////////////

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
	this.obj = getObjNN4(document,name);
	this.style = this.obj;
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
			foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

function getFrmObj(name)
{
  	if (navigator.family == 'nn4') {
  		var FrmObj=eval("document.ids['" + name + "']");
  	}
  	else if (navigator.family == 'ie4') {
  		var FrmObj=eval("document.all." + name);
  	}
  	else if (navigator.family == 'gecko' || navigator.family == 'opera') {
  		var FrmObj=eval("document.getElementById('" + name + "')");
	}
	else if (navigator.family == 'opera') {
  		var FrmObj=eval("document.getElementById('" + name + "')");
	}
	return FrmObj
}

function getNameObj(name)
{
  	if (navigator.family == 'nn4') {
  		var FrmNameObj=eval("document.ids['" + name + "']");
  	}
  	else if (navigator.family == 'ie4') {
  		var FrmNameObj=eval("document.all." + name);
  	}
  	else if (navigator.family == 'gecko' || navigator.family == 'opera') {
  		var FrmNameObj=eval("document.getElementsByName('" + name + "')");
	}
	else if (navigator.family == 'opera') {
  		var FrmNameObj=eval("document.getElementsByName('" + name + "')");
	}
	return FrmNameObj
}

function chkTickBox_click(chkId){
	var chkObj = getFrmObj(chkId)
	if(chkObj.value=="on"){
		chkObj.value="off"
	}else{
		chkObj.value="on"
	}
}

//Let Only Numbers in
function checkIt(evt) {
    evt = (evt) ? evt : window.event
         var charCode = (evt.which) ? evt.which : evt.keyCode
              if (charCode > 31 && (charCode < 48 || charCode > 57)) {
				if (charCode!=46){
                   alert('This field only accepts numbers or decimal points.')
                   status = "This field accepts numbers only."
                   return false
                }
              }
              status = ""
         return true
}

///////////////////////////////////////////////////////////////////////
//
// Custom Form javascript
//
///////////////////////////////////////////////////////////////////////

function CFDivPosition() {
	var c = getAnchorPosition("AnchorCustomForm");

	if (navigator.family == 'nn4') {
		var o=eval("document.layers['CustomForm']");
	}
	else if (navigator.family == 'ie4') {
		var o=eval("document.all['CustomForm'].style");
	}
	else if (navigator.family == 'gecko' || navigator.family == 'opera') {
		var o=eval("document.getElementById('CustomForm').style");
	}

	var ocfx=getFrmObj('txtCustomFormX')
	var ocfy=getFrmObj('txtCustomFormY')

	if (cfPos==0){
		if (navigator.family == 'gecko' && strCanEditLayup=='yes'){
			o.left = c.x;
			o.top = c.y + 74;
		}else{
			o.left = c.x;
			o.top = c.y;
		}
	}
	o.visibility="visible"
}

function SubmitCustomForm() {
	var frmObj=getFrmObj('frmCustomEmailForm')

    //window.open('EmailForm.asp');
    
	var nocaptcha = getFrmObj("nocaptchacode")
	if (nocaptcha.value == "yes"){
		var inputElements = document.getElementsByTagName('input');
    	var VerifiedInput = true
		for(var i = 0; i < inputElements.length; i++){
			//alert(inputElements[i].name + ": " + InStr(inputElements[i].name, "*"))
			if (InStr(inputElements[i].name, "*") > -1){
				if (inputElements[i].type == "radio" || inputElements[i].type == "checkbox"){
					if (inputElements[i].checked == "true"){
						VerifiedInput = true
					}else{
						VerifiedInput = false
					}
				}else{
					if (inputElements[i].value != ""){
						VerifiedInput = true
					}else{
						VerifiedInput = false
					}
				}
			}
		}

    	if (VerifiedInput){
    		frmObj.submit();
    	}else{
    		alert("You must fill in all fields marked with an asterix (*)!")
    	}
	}else{
		var captchac = getFrmObj("captchacode")
	    if (captchac != ""){
	    	var inputElements = document.getElementsByTagName('input');
	    	var VerifiedInput = true
			for(var i = 0; i < inputElements.length; i++){
				//alert(inputElements[i].name + ": " + InStr(inputElements[i].name, "*"))
				if (InStr(inputElements[i].name, "*") > -1){
					if (inputElements[i].type == "radio" || inputElements[i].type == "checkbox"){
						if (inputElements[i].checked == "true"){
							VerifiedInput = true
						}else{
							VerifiedInput = false
						}
					}else{
						if (inputElements[i].value != ""){
							VerifiedInput = true
						}else{
							VerifiedInput = false
						}
					}
				}
			}

	    	if (VerifiedInput){
	    		frmObj.submit();
	    	}else{
	    		alert("You must fill in all fields marked with an asterix (*)!")
	    	}
	    }else{
	    	alert("You must enter the characters in the image to submit this form!")
	    }
	}
}

function RefreshImage(valImageId) {
	var objImage = document.images[valImageId];
	if (objImage == undefined) {
		return;
	}
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}

///////////////////////////////////////////////////////////////////////
//
// Error handler
//
///////////////////////////////////////////////////////////////////////

function doError(a1,a2,a3) {
	return true
}

 function Mid(str, start, len)
/***
		IN: str - the string we are LEFTing
			start - our string's starting position (0 based!!)
			len - how many characters from start we want to get

		RETVAL: The substring from start to start+len
***/
{
		// Make sure start and len are within proper bounds
		if (start < 0 || len < 0) return "";

		var iEnd, iLen = String(str).length;
		if (start + len > iLen)
				iEnd = iLen;
		else
				iEnd = start + len;

		return String(str).substring(start,iEnd);
}

function Len(str)
/***
		IN: str - the string whose length we are interested in

		RETVAL: The number of characters in the string
***/
{  return String(str).length;  }


function InStr(strSearch, charSearchFor)
/*
InStr(strSearch, charSearchFor) : Returns the first location a substring (SearchForStr)
						   was found in the string str.  (If the character is not
						   found, -1 is returned.)

Requires use of:
	Mid function
	Len function
*/
{
	for (i=0; i < Len(strSearch); i++)
	{
		if (charSearchFor == Mid(strSearch, i, Len(charSearchFor)))
		{
			return i;
		}
	}
	return -1;
}

///////////////////////////////////////////////////////////////////////
//
// Footer Javascript
//
///////////////////////////////////////////////////////////////////////

var winW,winH

function FindPH(){
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		winW = window.innerWidth;
		winH = window.innerHeight;
	} else {
		if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			winW = document.documentElement.clientWidth;
			winH = document.documentElement.clientHeight;
		} else {
			if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				//IE 4 compatible
				winW = document.body.clientWidth;
				winH = document.body.clientHeight;
			}
		}
	}
}

var ObjHeight=0
var ObjTop=0

function GetObjectHeight(which){
	if (document.layers){
		ObjHeight = which.document.height;
	}else if (document.all || document.getElementById){
		var test1 = document.body.scrollHeight;
		var test2 = document.body.offsetHeight
		if (test1 > test2) // all but Explorer Mac
		{
			ObjHeight = which.scrollHeight;
		}
		else // Explorer Mac;
		     //would also work in Explorer 6 Strict, Mozilla and Safari
		{
			ObjHeight = which.offsetHeight;
		}

	}
}

function GetObjectTop(which){
	//alert("txt" + which + "Y")
	var objT = getFrmObj("txt" + which + "Y")
	ObjTop = parseInt(objT.value) + parseInt(intEdit)
}

var bodyHeight=parseInt(PContentHeight)
var footerHeight=0

function ElementHeight() {
	var PageElements = document.getElementsByTagName('div');
	for(var i = 0; i < PageElements.length; i++){
		if (PageElements[i].className =="bodyElement"){
			if (PageElements[i].id == "CustomForm"){
				if (cfHeight!= -1){
					ObjHeight=cfHeight
				}else{
					GetObjectHeight(PageElements[i])
				}
			}else{
				GetObjectHeight(PageElements[i])
			}
			GetObjectTop(PageElements[i].id)
			//if (intUserLevel>999){
			//	alert(PageElements[i].id + ": height " + ObjHeight + ":top " + ObjTop)
			//}
			var newHeight=parseInt(ObjTop) + parseInt(ObjHeight)
			//if (intUserLevel>999){
			//	alert("NewHeight: " + newHeight)
			//}
			var ObjElement=getFrmObj(PageElements[i].id)
			ObjElement.style.height=parseInt(ObjHeight)
			if (parseInt(newHeight) > parseInt(bodyHeight)){
				bodyHeight=(parseInt(ObjTop) + parseInt(ObjHeight))
				//if (intUserLevel>999){
					//alert("bodyHeight: " + bodyHeight)
				//}
			}
		}
	}
	var PageElements = document.getElementsByTagName('table');
	for(var i = 0; i < PageElements.length; i++){
		if (PageElements[i].className =="footer"){
			GetObjectHeight(PageElements[i])
			//alert(PageElements[i].id + ":" + ObjHeight)
			footerHeight=parseInt(ObjHeight)
			//alert(footerHeight)
		}
	}
}

function MainTableHeight(which){
	var MainTableObj= getFrmObj(which)
	ElementHeight()
	FindPH()
	//if (intUserLevel>999){
	//	alert(bodyHeight + ":" + parseInt(footerHeight) + ":" + winH)
	//}
	if ((bodyHeight + parseInt(footerHeight)) > winH){
		MainTableObj.style.height=bodyHeight + parseInt(footerHeight)
		var topcell=getFrmObj('topcell')
		topcell.height=bodyHeight
		var botcell=getFrmObj('botcell')
		botcell.height=parseInt(footerHeight)
		if(intFooterWidth=="100%"){
			if( typeof( window.innerWidth ) == 'number' ) {
				MainTableObj.style.width=winW-19
			}else{
				MainTableObj.style.width=winW
			}
		}else{
			MainTableObj.style.width=intFooterWidth
		}
		//if (intUserLevel>999){
		//	alert(MainTableObj.style.height)
		//}
	}else{
		MainTableObj.style.height=winH
		var topcell=getFrmObj('topcell')
		topcell.height=winH-parseInt(footerHeight)
		var botcell=getFrmObj('botcell')
		botcell.height=parseInt(footerHeight)
		if(intFooterWidth=="100%"){
			MainTableObj.style.width=winW
		}else{
			MainTableObj.style.width=intFooterWidth
		}
	}
	MainTableObj.style.visibility='visible'
}

var OldBodyHeight = 0

function MainTableHeight2(which, changeback){
	var MainTableObj= getFrmObj(which)
	if (changeback == 1){
		OldBodyHeight = bodyHeight
		ElementHeight()
		FindPH()
	}else{
		bodyHeight = OldBodyHeight
	}

	//if (intUserLevel>999){
	//	alert(OldBodyHeight + ":" + bodyHeight + ":" + parseInt(footerHeight) + ":" + winH)
	//}
	if ((bodyHeight + parseInt(footerHeight)) > winH){
		MainTableObj.style.height=bodyHeight + parseInt(footerHeight)
		var topcell=getFrmObj('topcell')
		topcell.height=bodyHeight
		var botcell=getFrmObj('botcell')
		botcell.height=parseInt(footerHeight)
		if(intFooterWidth=="100%"){
			if( typeof( window.innerWidth ) == 'number' ) {
				MainTableObj.style.width=winW-19
			}else{
				MainTableObj.style.width=winW
			}
		}else{
			MainTableObj.style.width=intFooterWidth
		}
		//if (intUserLevel>999){
		//	alert(MainTableObj.style.height)
		//}
	}else{
		MainTableObj.style.height=winH
		var topcell=getFrmObj('topcell')
		topcell.height=winH-parseInt(footerHeight)
		var botcell=getFrmObj('botcell')
		botcell.height=parseInt(footerHeight)
		if(intFooterWidth=="100%"){
			MainTableObj.style.width=winW
		}else{
			MainTableObj.style.width=intFooterWidth
		}
	}
	MainTableObj.style.visibility='visible'
}

///////////////////////////////////////////////////////////////////////
//
// Search Javascript
//
///////////////////////////////////////////////////////////////////////

function SearchSite(){
	if (navigator.family == 'nn4') {
		var frmObj=eval("document.ids['frmEdit']");
	}
	else if (navigator.family == 'ie4') {
		var frmObj=eval("document.all.frmEdit");
	}
	else if (navigator.family == 'gecko' || navigator.family == 'opera') {
		var frmObj=eval("document.getElementById('frmEdit')");
	}

	var keyword=getFrmObj("SearchTerm")

	frmObj.action="ESMSearch.asp?Keyword=" + keyword.value
	frmObj.submit()
}


///////////////////////////////////////////////////////////////////////
//
// Login Javascript
//
///////////////////////////////////////////////////////////////////////

function mySubmit(){
	var objPass=getFrmObj('txtPassword');
	var objUserName=getFrmObj('txtUserName');
	if (objPass.value != "" && objUserName.value != ""){
		if (navigator.family == 'nn4') {
			var frmObj=eval("document.ids['frmEdit']");
		}
		else if (navigator.family == 'ie4') {
			var frmObj=eval("document.all.frmEdit");
		}
		else if (navigator.family == 'gecko' || navigator.family == 'opera') {
			var frmObj=eval("document.getElementById('frmEdit')");
		}
		frmObj.action="Login.asp?PageNo=" + intPageNo + "&Login=yes&cl=n&pl=n"
		frmObj.submit()
	}else{
		alert("You just enter a User Name and Password!")
	}
}

function mySubmit2(){
	var objPass=getFrmObj('txtPassword2');
	var objUserName=getFrmObj('txtUserName2');
	if (objPass.value != "" && objUserName.value != ""){
		if (navigator.family == 'nn4') {
			var frmObj=eval("document.ids['frmEdit']");
		}
		else if (navigator.family == 'ie4') {
			var frmObj=eval("document.all.frmEdit");
		}
		else if (navigator.family == 'gecko' || navigator.family == 'opera') {
			var frmObj=eval("document.getElementById('frmEdit')");
		}
		frmObj.action="Login.asp?PageNo=" + intPageNo + "&Login=yes&cl=y&pl=n"
		frmObj.submit()
	}else{
		alert("You just enter a User Name and Password!")
	}
}

function mySubmit3(){
	var objPass=getFrmObj('txtPassword');
	var objUserName=getFrmObj('txtUserName');
	if (objPass.value != "" && objUserName.value != ""){
		if (navigator.family == 'nn4') {
			var frmObj=eval("document.ids['frmEdit']");
		}
		else if (navigator.family == 'ie4') {
			var frmObj=eval("document.all.frmEdit");
		}
		else if (navigator.family == 'gecko' || navigator.family == 'opera') {
			var frmObj=eval("document.getElementById('frmEdit')");
		}
		frmObj.action="Login.asp?PageNo=" + intPageNo + "&Login=yes&cl=n&pl=y"
		frmObj.submit()
	}else{
		alert("You just enter a User Name and Password!")
	}
}

function emailCheck (emailStr) {

	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);

	if (matchArray==null) {
		alert("Email address seems incorrect (check @ and .'s)");
	return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			alert("Ths username contains invalid characters.");
			return false;
	   }
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			alert("Ths domain name contains invalid characters.");
			return false;
	   }
	}

	if (user.match(userPat)==null) {
		alert("The username doesn't seem to be valid.");
		return false;
	}

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("Destination IP address is invalid!");
				return false;
			}
		}
		return true;
	}

	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			alert("The domain name does not seem to be valid.");
			return false;
	   }
	}

	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {
		alert("The address must end in a well-known domain or two letter " + "country.");
		return false;
	}

	if (len<2) {
		alert("This address is missing a hostname!");
		return false;
	}

	return true;
}

function btnMyDetailsClick(){
	if (navigator.family == 'nn4') {
		var frmObj=eval("document.ids['frmEdit']");
	}
	else if (navigator.family == 'ie4') {
		var frmObj=eval("document.all.frmEdit");
	}
	else if (navigator.family == 'gecko' || navigator.family == 'opera') {
		var frmObj=eval("document.getElementById('frmEdit')");
	}
	if (intUserID!=0){
		frmObj.action="Register.asp?MyDetails=yes"
		frmObj.submit()
	}else{
		alert("You needed to be logged in to see your details!")
	}
}

function RegisterClick(){
	if (navigator.family == 'nn4') {
		var frmObj=eval("document.ids['frmEdit']");
	}
	else if (navigator.family == 'ie4') {
		var frmObj=eval("document.all.frmEdit");
	}
	else if (navigator.family == 'gecko' || navigator.family == 'opera') {
		var frmObj=eval("document.getElementById('frmEdit')");
	}
	frmObj.action="Register.asp?NewRegister=yes"
	frmObj.submit()
}

function ShowLoginBox(){
	var objLogB = new getObj('Login2Div');
	if (objLogB.style.visibility=='visible'){
		objLogB.style.visibility='hidden'
	}else{
		objLogB.style.visibility='visible'
	}
	//LoginBoxPos()
}

function LoginBoxPos() {
	var c = getAnchorPosition("AnchorLoginBox");
	var o = new getObj('Login2Div');
	o.style.left = c.x;
	o.style.top = c.y + parseInt(LogButHeight);
}

///////////////////////////////////////////////////////////////////////
//
// Flash Gallery Functions
//
///////////////////////////////////////////////////////////////////////

function LoadGallery(id,server,h,w,type,bgcol){
	
	var frameobj=getFrmObj("flashgallerframe")
	if (server == "element78"){
		frameobj.src="/images" + intURLID + "/gallery" + id + "/gallery.asp?w=" + w + "&h=" + h + "&fgtype=" + type + "&bgcolval=" + bgcol;
	}else{
		frameobj.src="/images/gallery" + id + "/gallery.asp?w=" + w + "&h=" + h + "&fgtype=" + type + "&bgcolval=" + bgcol;
	}
}

///////////////////////////////////////////////////////////////////////
//
// Menu handling functions
//
///////////////////////////////////////////////////////////////////////

// handle show/hide maindiv timer
var TimerIDMain;
var lastLayerMain = -1
function layerHandlerMain(whichLayer, roll_on) {
	if (roll_on=='on') {

    		clearTimeout(TimerIDMain);

		if (lastLayerMain != -1){
			changeState('sub' + lastLayerMain, 'off');
			mouseouttdMain('tdMain' + lastLayerMain);
		}

		changeState('sub' + whichLayer, 'on');
		mouseovertdMain('tdMain' + whichLayer);
		lastLayerMain = whichLayer;

 	} else {
    		clearTimeout(TimerIDMain);
    		TimerIDMain = setTimeout('hideSubs(lastLayerMain)', 1200);
  	}
}

// hide everything but 'exceptThis'

function hideSubs(which) {
	if (which != -1){
		changeState('sub' + which, 'off');
		mouseouttdMain('tdMain' + which);
	}
}

// handle show/hide sidediv timer
var TimerIDSide;
var lastLayerSide = -1
function layerHandlerSide(whichLayer, roll_on) {
	if (roll_on=='on') {

		clearTimeout(TimerIDSide);

		if (lastLayerSide != -1){
			changeState('Grp' + lastLayerSide, 'off');
			mouseouttdSec('tdSec' + lastLayerSide);
		}

		changeState('Grp' + whichLayer, 'on');
		mouseovertdSec('tdSec' + whichLayer);
		lastLayerSide = whichLayer;

 	} else {
		clearTimeout(TimerIDSide);
		TimerIDSide = setTimeout('hideSideSubs(lastLayerSide)', 1200);
  	}
}

// hide everything but 'exceptThis'

function hideSideSubs(which) {
	if (which != -1){
		changeState('Grp' + which, 'off');
		mouseouttdSec('tdSec' + which);
	}
}

// change visibility state

var display = new String()
var nodisplay = new String()

if (navigator.family == 'nn4') {
	display = "show";
	nodisplay = "hide";
}
else if (navigator.family == 'ie4') {
	display = "visible";
	nodisplay = "hidden";
}
else if (navigator.family == 'gecko' || navigator.family == 'opera') {
	display = "visible";
	nodisplay = "hidden";
}

function changeState (layerRef, state) {
	if (state == "on") {
		var divState = display;
	}else{
		var divState = nodisplay;
	}
	if (navigator.family == 'nn4') {
		eval("document.layers['" + layerRef + "'].visibility='" + divState +"'");
	}
	else if (navigator.family == 'ie4') {
		eval("document.all['" + layerRef + "'].style.visibility='" + divState + "'");
	}
	else if (navigator.family == 'gecko' || navigator.family == 'opera') {
		eval("document.getElementById('" + layerRef + "').style.visibility='" + divState + "'");
	}
}

//change background color
function mouseovertdMain(which){
	if (which != strMainMenuNo){
		if (activecolorMain!="none"){
			if (navigator.family == 'nn4') {
				eval("document.ids['" + which + "'].backgroundColor =activecolorMain");
			}
			else if (navigator.family == 'ie4') {
				eval("document.all." + which + ".style.backgroundColor =activecolorMain");
			}
			else if (navigator.family == 'gecko' || navigator.family == 'opera') {
				eval("document.getElementById('" + which + "').style.backgroundColor =activecolorMain");
			}
		}
	}
}

function mouseovertdMain2(which) {
	//if (intUserLevel > 999) {alert(which)}
	if (activecolorMain!="none"){
		if (navigator.family == 'nn4') {
			eval("document.ids['" + which + "'].backgroundColor =activecolorMain");
		}
		else if (navigator.family == 'ie4') {
			eval("document.all." + which + ".style.backgroundColor =activecolorMain");
		}
		else if (navigator.family == 'gecko' || navigator.family == 'opera') {
			//if (intUserLevel > 999) {alert(activecolorMain)}
			eval("document.getElementById('" + which + "').style.backgroundColor =activecolorMain");
		}
	}
}

function mouseovertdSub(which) {
	if (activecolorSub!="none"){
		if (navigator.family == 'nn4') {
			eval("document.ids['" + which + "'].backgroundColor =activecolorSub");
		}
		else if (navigator.family == 'ie4') {
			eval("document.all." + which + ".style.backgroundColor =activecolorSub");
		}
		else if (navigator.family == 'gecko' || navigator.family == 'opera') {
			eval("document.getElementById('" + which + "').style.backgroundColor =activecolorSub");
		}
	}
}

function mouseouttdMain(which) {
	if (which != strMainMenuNo){
		if (inactivecolorMain!="none"){
			if (navigator.family == 'nn4') {
				eval("document.ids['" + which + "'].backgroundColor =inactivecolorMain");
			}
			else if (navigator.family == 'ie4') {
				eval("document.all." + which + ".style.backgroundColor =inactivecolorMain");
			}
			else if (navigator.family == 'gecko' || navigator.family == 'opera') {
				eval("document.getElementById('" + which + "').style.backgroundColor =inactivecolorMain");
			}
		}
	}
}

function mouseouttdSub(which) {
	if (inactivecolorSub!="none"){
		if (navigator.family == 'nn4') {
			eval("document.ids['" + which + "'].backgroundColor =inactivecolorSub");
		}
		else if (navigator.family == 'ie4') {
			eval("document.all." + which + ".style.backgroundColor =inactivecolorSub");
		}
		else if (navigator.family == 'gecko' || navigator.family == 'opera') {
			eval("document.getElementById('" + which + "').style.backgroundColor =inactivecolorSub");
		}
	}
}

//change background color Sec & Grp
function mouseovertdSec(which) {
	if (which != strSecMenuNo){
		if (activecolorSec!="none"){
			if (navigator.family == 'nn4') {
				eval("document.ids['" + which + "'].backgroundColor =activecolorSec");
			}
			else if (navigator.family == 'ie4') {
				eval("document.all." + which + ".style.backgroundColor =activecolorSec");
			}
			else if (navigator.family == 'gecko' || navigator.family == 'opera') {
				eval("document.getElementById('" + which + "').style.backgroundColor =activecolorSec");
			}
		}
	}
}

function mouseovertdSec2(which) {
	if (activecolorSec!="none"){
		if (navigator.family == 'nn4') {
			eval("document.ids['" + which + "'].backgroundColor =activecolorSec");
		}
		else if (navigator.family == 'ie4') {
			eval("document.all." + which + ".style.backgroundColor =activecolorSec");
		}
		else if (navigator.family == 'gecko' || navigator.family == 'opera') {
			if (document.getElementById(which)){
				eval("document.getElementById('" + which + "').style.backgroundColor =activecolorSec");
			}
		}
	}
}

function mouseovertdGrp(which) {
	if (activecolorGrp!="none"){
		if (navigator.family == 'nn4') {
			eval("document.ids['" + which + "'].backgroundColor =activecolorGrp");
		}
		else if (navigator.family == 'ie4') {
			eval("document.all." + which + ".style.backgroundColor =activecolorGrp");
		}
		else if (navigator.family == 'gecko' || navigator.family == 'opera') {
			eval("document.getElementById('" + which + "').style.backgroundColor =activecolorGrp");
		}
	}
}

function mouseouttdSec(which) {
	if (which != strSecMenuNo){
		if (inactivecolorSec!="none"){
			if (navigator.family == 'nn4') {
				eval("document.ids['" + which + "'].backgroundColor =inactivecolorSec");
			}
			else if (navigator.family == 'ie4') {
				eval("document.all." + which + ".style.backgroundColor =inactivecolorSec");
			}
			else if (navigator.family == 'gecko' || navigator.family == 'opera') {
				eval("document.getElementById('" + which + "').style.backgroundColor =inactivecolorSec");
			}
		}
	}
}

function mouseouttdGrp(which) {
	if (inactivecolorGrp!="none"){
		if (navigator.family == 'nn4') {
			eval("document.ids['" + which + "'].backgroundColor =inactivecolorGrp");
		}
		else if (navigator.family == 'ie4') {
			eval("document.all." + which + ".style.backgroundColor =inactivecolorGrp");
		}
		else if (navigator.family == 'gecko' || navigator.family == 'opera') {
			eval("document.getElementById('" + which + "').style.backgroundColor =inactivecolorGrp");
		}
	}
}

//-------------------------------------------------------------
// LOAD SURVEY QUESTIONS
//-------------------------------------------------------------

function LoadSurvey(){
	httpRequest("GetSurveyPage.asp?PageNo=" + intPageNo + "&userid=" + intUserID, DisplaySurvey, "data");
}

function DisplaySurvey(data){
	if (data != ""){
		var surveyDiv = getFrmObj('divSurvey');
		surveyDiv.innerHTML = data
		MainTableHeight('mainDiv')
	}
}

function SaveSurvey(){
	if (parseInt(intUserLevel)==0){
		alert("You must Register or Login to complete this survey!")
	}else{
		if (ValidateFields()){
			var frmObj=getFrmObj('frmEdit')
			strValues = getFormValues(frmObj)
			//alert(strValues)
			httpRequestPost("GetSurveyPage.asp?PageNo=" + intPageNo + "&userid=" + intUserID + "&Update=y", SurveyChangePage, "data", strValues);
		}else{
			alert("You must enter a value in all the fields marked with an asterix (*)!")
		}
	}
}

function deleteQ(which){
	var frmObj=getFrmObj('frmEdit');
	frmObj.action="default.asp?PageNo=" + intPageNo + "&save=DeleteQ&QID=" + which
	frmObj.submit();
}

function SurveyChangePage(){
	window.location="default.asp?pageno=" + intGoToPage
}

var HidCheck
function GetCheck(count){
	if (navigator.family == 'nn4') {
		HidCheck=eval("document.ids['hcheck" + count + "']");
	}
	else if (navigator.family == 'ie4') {
		HidCheck=eval("document.all.hcheck" + count);
	}
	else if (navigator.family == 'gecko' || navigator.family == 'opera') {
		HidCheck=eval("document.getElementById('hcheck" + count + "')");
	}
}

var QObj
function GetObj(id){
	if (navigator.family == 'nn4') {
		QObj=eval("document.ids['" + id + "']");
	}
	else if (navigator.family == 'ie4') {
		QObj=eval("document.all." + id);
	}
	else if (navigator.family == 'gecko' || navigator.family == 'opera') {
		QObj=eval("document.getElementById('" + id + "')");
	}
}

function validIT(id,count,type){
	if (type=="Text"){
		HidCheck=getFrmObj("hcheck" + count);
		QObj=getFrmObj(id);
		if (QObj.value !=""){
			HidCheck.value="1";
		}
	}
	else if (type=="Textarea"){
		HidCheck=getFrmObj("hcheck" + count);
		QObj=getFrmObj(id);
		if (QObj.innerText !=""){
			HidCheck.value="1";
		}
	}
	else if (type=="Checkbox"){
		HidCheck=getFrmObj("hcheck" + count);
		HidCheck.value="1";
	}
	else if (type=="Select"){
		HidCheck=getFrmObj("hcheck" + count);
		QObj=getFrmObj(id);
		if (QObj.value !="-1"){
			HidCheck.value="1";
		}
	}
}



// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
//
// You may *NOT* re-distribute this code in any way except through its
// use. That means, you can include it in your product, or your web
// site, or any other form where the code is actually being used. You
// may not put the plain javascript up on your site for download or
// include it in your javascript libraries for download.
// If you wish to share this code with others, please just point them
// to the URL instead.
// Please DO NOT link directly to my .js files from your site. Copy
// the files to your server and use them there. Thank you.
// ===================================================================

/*
AnchorPosition.js
Author: Matt Kruse
Last modified: 10/11/02

DESCRIPTION: These functions find the position of an <A> tag in a document,
so other elements can be positioned relative to it.

COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small
positioning errors - usually with Window positioning - occur on the
Macintosh platform.

FUNCTIONS:
getAnchorPosition(anchorname)
  Returns an Object() having .x and .y properties of the pixel coordinates
  of the upper-left corner of the anchor. Position is relative to the PAGE.

getAnchorWindowPosition(anchorname)
  Returns an Object() having .x and .y properties of the pixel coordinates
  of the upper-left corner of the anchor, relative to the WHOLE SCREEN.

NOTES:

1) For popping up separate browser windows, use getAnchorWindowPosition.
   Otherwise, use getAnchorPosition

2) Your anchor tag MUST contain both NAME and ID attributes which are the
   same. For example:
   <A NAME="test" ID="test"> </A>

3) There must be at least a space between <A> </A> for IE5.5 to see the
   anchor tag correctly. Do not do <A></A> with no space.
*/

// getAnchorPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the page.
function getAnchorPosition(anchorname) {
	// This function will return an Object with x and y properties
	var useWindow=false;
	var coordinates=new Object();
	var x=0,y=0;
	// Browser capability sniffing
	var use_gebi=false, use_css=false, use_layers=false;
	if (document.getElementById) { use_gebi=true; }
	else if (document.all) { use_css=true; }
	else if (document.layers) { use_layers=true; }
	// Logic to find position
 	if (use_gebi && document.all) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_gebi) {
		var o=document.getElementById(anchorname);
		x=AnchorPosition_getPageOffsetLeft(o);
		y=AnchorPosition_getPageOffsetTop(o);
		}
 	else if (use_css) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_layers) {
		var found=0;
		for (var i=0; i<document.anchors.length; i++) {
			if (document.anchors[i].name==anchorname) { found=1; break; }
			}
		if (found==0) {
			coordinates.x=0; coordinates.y=0; return coordinates;
			}
		x=document.anchors[i].x;
		y=document.anchors[i].y;
		}
	else {
		coordinates.x=0; coordinates.y=0; return coordinates;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// getAnchorWindowPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the window
function getAnchorWindowPosition(anchorname) {
	var coordinates=getAnchorPosition(anchorname);
	var x=0;
	var y=0;
	if (document.getElementById) {
		if (isNaN(window.screenX)) {
			x=coordinates.x-document.body.scrollLeft+window.screenLeft;
			y=coordinates.y-document.body.scrollTop+window.screenTop;
			}
		else {
			x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
			y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
			}
		}
	else if (document.all) {
		x=coordinates.x-document.body.scrollLeft+window.screenLeft;
		y=coordinates.y-document.body.scrollTop+window.screenTop;
		}
	else if (document.layers) {
		x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
		y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// Functions for IE to get position of an object
function AnchorPosition_getPageOffsetLeft (el) {
	if (el){
		var ol=el.offsetLeft;
		while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
		return ol;
		}
	}
function AnchorPosition_getWindowOffsetLeft (el) {
	return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
	}
function AnchorPosition_getPageOffsetTop (el) {
	if (el){
		var ot=el.offsetTop;
		while((el=el.offsetParent) != null) { ot += el.offsetTop; }
		return ot;
		}
	}
function AnchorPosition_getWindowOffsetTop (el) {
	return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
	}


//window.onerror = doError
