var swf_list = new Array();
function swf_display()
{
	var ic = swf_list.length;
	for(i=0;i<ic;i++)
	{
	
		changeObjectInnerHTML("swf_"+(i+1),swf_list[i]);
		
	}
}

function swf_fixer(s)
{
	document.write(s);
}
var nn4 = (document.layers) ? true : false 
var ie = (document.all) ? true : false 
var dom = (document.getElementById && !document.all) ? true : false 


var chasm = screen.availWidth;
var mount = screen.availHeight;

//var cButtonColor="#3871A9";
//var hButtonColor="#5991C8";


//###################################################
//var IFRAMELOADING=1;
//var IFRAMECOUNT=0;

var global_vars= new Array(1000);

function setGlobal(oName,oValue)
{
	global_vars[oName]=oValue;
	return global_vars[oName];
}

function setGlobalImage(oName,oPath)
{
	var img = new Image();
	img.src = oPath;
	return setGlobal(oName, img );
	
}

function setGlobalArray(oName)
{
	var img = new Array();

	return 	setGlobal(oName, img );
}

function getGlobal(oName)
{
	return 	global_vars[oName];
}

function deleteGlobal(oName)
{
	if(global_vars[oName])
	delete 	global_vars[oName];
}

function getMyTimer()
{
	return getGlobal('myTimer');			

}
var displayedTimerError=0;


function MyTimerWaitProc()
{

	var mytimer = 	getGlobal('myTimer');			
	if(!mytimer) 
	{
	  if(!displayedTimerError)
	  		alert('timer error unable to find MyTimerObject');		
			displayedTimerError=1;
		return;
	}
	if(mytimer.active!=1) 
	{
		clearInterval(mytimer.timerid);
		deleteGlobal( 'myTimer' );
		//alert('MyTimer.Active = 0');
	}
	else
	{
			var checkval = getGlobal(mytimer.CheckIsSet);
			if(checkval==1) 
			{
				clearInterval(mytimer.timerid);
				mytimer.active=0;
				mytimer.doneproc();
				deleteGlobal( 'myTimer' );
				//alert('timer CheckValue = 1');
				
				
			}
			else
			{
					mytimer.counter++;
					
						if(mytimer.counter>=mytimer.maxcount)
						{
								clearInterval(mytimer.timerid);
								mytimer.active=0;
								mytimer.maxproc();
								deleteGlobal( 'myTimer' );
								//alert(this+'timer max has been reached');
						   		
						}
						else
						mytimer.intervalproc();
			}
			
					
			
	}
}


function TabObject(oType)
{

	this.id=0;
	this.obj=0;
	this.type=oType;
	this.over=0;
	this.selected=0;
	this.normal=0;
	this.active=0;
	this.active_proc;

}

function createTabObjects(oName,num,oType)
{
	var str = new Array();
	var len=num;
	var i;
	for(i=0;i<len;i++)
	{
		str[i]=new TabObject(oType);
	}

	 setGlobal(oName,str);
	return str;
}

function setTabActive(oName,oID,eventObj)
{
/*
   if(eventObj) 
   {
		// stop event from bubbling up any farther
		eventObj.cancelBubble = true;	
	}
*/	
	var str = getGlobal(oName);
	var len = str.length;
	//alert("num in array = "+len);
	var i;
	for(i=0;i<len;i++)
	{
	
			var tabObj = str[i];
			var ensureActive=false;

			//##################################
			//alert("type = "+tabObj.type+" oID = "+oID+" tabID = "+tabObj.id);
			if(oID==tabObj.id)
			{
				ensureActive=true;
			}
			
			if(ensureActive)
			{
						if(tabObj.active==0)
						{
									if(tabObj.type=='IMG')
									{
										
										if(tabObj.selected) 
										{
							//alert("selected = "+tabObj.selected);			
											changeObjectSRC(tabObj.id,tabObj.selected);
										}
										
									}						
									else if(tabObj.type=='STYLE')
									{
										
											if(tabObj.selected) 
											{
								//alert("selected = "+tabObj.selected);			
												objstyle.background=tabObj.selected;
												
											}
									}
		
							
								tabObj.active=1;
								if(tabObj.active_proc) tabObj.active_proc( tabObj );
							 
					   }
			}
			else //if(tabObj.active)
			{
				if(tabObj.active)
				{
								//alert("normal");
								if(tabObj.type=='IMG')
								{
				//					if(tabObj.normal) obj.src = tabObj.normal;
								//alert("selected = "+tabObj.normal);			
									changeObjectSRC(tabObj.id,tabObj.normal);
								}
								else if(tabObj.type=='STYLE')
								{
								//alert("selected = "+tabObj.normal);			
										if(tabObj.normal) objstyle.background=tabObj.normal;
								}
								
								tabObj.active=0;
				}
					
			}
			
	
	}
	
return true;
}

function clearTabActive(oName,eventObj)
{
/*
   if(eventObj) 
   {
		// stop event from bubbling up any farther
		eventObj.cancelBubble = true;	
	}
*/	
	var str = getGlobal(oName);
	var len = str.length;
	//alert("num in array = "+len);
	var i;
	for(i=0;i<len;i++)
	{
			var tabObj = str[i];			
		if(tabObj.active)
				{
								//alert("normal");
								if(tabObj.type=='IMG')
								{
				//					if(tabObj.normal) obj.src = tabObj.normal;
								//alert("selected = "+tabObj.normal);			
									changeObjectSRC(tabObj.id,tabObj.normal);
								}
								else if(tabObj.type=='STYLE')
								{
								//alert("selected = "+tabObj.normal);			
										if(tabObj.normal) objstyle.background=tabObj.normal;
								}
								
								tabObj.active=0;
				}	
	}
	
return true;
}
function mytimer_doneproc()
{

}
function mytimer_maxproc()
{

}
function mytimer_intervalproc()
{

}
function MyTimerWait(oCheckID,oMaxWait)
{
	this.CheckIsSet = oCheckID;
	this.proc = MyTimerWaitProc;
	this.active=1;
	this.counter=0;
	this.delay=300;
	this.maxcount=oMaxWait;
	this.timerid=0;//setInterval(this.proc, 250);
	this.doneproc=mytimer_doneproc;
	this.maxproc=mytimer_maxproc;
	this.intervalproc=mytimer_intervalproc;
	this.name=0;
}

function startMyTimer(oTimer,oName)
{
	//oTimer.name=oName;
	deleteGlobal('myTimer');
	setGlobal('myTimer',oTimer);
	
	oTimer.timerid=setInterval(oTimer.proc, oTimer.delay);
}
//#####################################################################

//###################################################

var isNS = navigator.appName.indexOf("Netscape")  != -1
var isIE = navigator.appName.indexOf("Microsoft") != -1

function cOn(td,color){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor=color;
}
}

function cOut(td,color){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor=color;
}
}
function cOn2(td,color,colort){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor=color;
td.style.color=colort;
}
}

function cOut2(td,color,colort){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor=color;
td.style.color=colort;
}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);

//###################################################

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	//confirm("unable to find STYLE object");
	return false;
    }
} // getStyleObject

function getObjectStyle(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	//confirm("unable to find STYLE object");
	return false;
    }
} // getStyleObject
function getIDObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	//confirm("unable to find STYLE object");
		alert("unable to find object id = "+objectId);
	return false;
    }
} // getStyleObject
// this is the same as above ---
function getObjectID(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	//confirm("unable to find STYLE object");
		alert("unable to find object id = "+objectId);
	return false;
    }
} // getStyleObject
// hidden or visible
function showlayer(objectID, show)
{
	if(show)
	{
		changeObjectVisibility(objectID, "visible");
	}
	else		changeObjectVisibility(objectID, "hidden");
}
function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
//	confirm("unable to find object");
	return false;
    }
} // changeObjectVisibility
function getObjectVisibility(objectId) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	return styleObject.visibility;// = newVisibility;
	//return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
//	confirm("unable to find object");
	return false;
    }
} // changeObjectVisibility

//###########################################################
function changeLayerContent(objectId,content,MakeVisible)
{
var layer = getIDObject(objectId);

	if(layer)
	{
		if(nn4) 
		{	
			layer.document.open()
			layer.document.write(content) //write content to layer
			layer.document.close()
		if(MakeVisible) layer.visibility="visible";	//change visibility to visible
		}
		else {		     
		layer.innerHTML = content  //write content to layer
		if(MakeVisible) changeObjectVisibility(objectId,"visible");	//change visibility to visible
		}
	}
}
//###########################################################

function changeObjectInnerHTML(objectId, newInner) {
    // get a reference to the cross-browser style object and make sure the object exists
    var idObject = getIDObject(objectId);
    if(idObject) {
	idObject.innerHTML = newInner;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	//confirm("unable to find object");
	return false;
    }
} // changeObjectVisibility

function changeObjectSRC(objectId, newSrc) {
    // get a reference to the cross-browser style object and make sure the object exists
    var idObject = getIDObject(objectId);
    if(idObject) {
	idObject.src = newSrc;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	//confirm("unable to find object");
	return false;
    }
} // changeObjectVisibility

function changeObjectHREF(objectID, newHREF) {
    // get a reference to the cross-browser style object and make sure the object exists
    var idObject = getIDObject(objectID);
    if(idObject) {
	idObject.href = newHREF;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	//confirm("unable to find object");
	return false;
    }
} // changeObjectVisibility

function changeObjectStyleWidth(objectId, newWidth) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.width = newWidth;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	//confirm("unable to find object");
	return false;
    }
} // changeObjectVisibility

function changeObjectStyleHeight(objectId, newHeight) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.height = newHeight;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	//confirm("unable to find object");
	return false;
    }
} // changeObjectVisibility
function moveObject(objectId, newXCoordinate, newYCoordinate) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.left = newXCoordinate;
	styleObject.top = newYCoordinate;
	return true;
    } else {
	// we couldn't find the object, so we can't very well move it
	return false;
    }
} // moveObject


function openfull( URL,nw,nh )
{

var w=800;
var h=600;
	if(nw) w = nw;
	if(nh) h = nh;

	if(chasm>800) 
	{
		if(w<=1024)
		w=900;
		else w=1000;
	}

	if(mount>600) h=mount-100;   

	if(w==800 && h==600)
	{
	OpenListingsWindow = window.open(URL, "", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,"+'width=' + w + ',height=' + h + ',left=' + 0 + ',top=' + 0)
	}
	else
	{
	
		OpenListingsWindow = window.open(URL, "", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,"+'width=' + w + ',height=' + h + ',left=' + ((chasm - w - 10) * .5) + ',top=' + ((mount - h - 30) * .5))
	}
}

function openfullWH( URL,w,h )
{

OpenListingsWindow = window.open(URL, "", "fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,"+'width=' + w + ',height=' + h + ',left=' + ((chasm - w - 10) * .5) + ',top=' + ((mount - h - 30) * .5))
}

function Shadow(oID,oR,oG,oB,offX, offY, positive)
{
 if (offX >= 1) 
 {
 //offX -= 1;
 //offY -= 1;
	var obj = getObjectID(oID);
	if(obj.style)
	{
	obj.style.filter="dropShadow(color=rgb("+oR+","+oG+","+oB+"),offX="+offX+",offY="+offY+",positive="+positive+")";
	//obj.style.filter="dropShadow(color=black,offX="+offX+",offY="+offY+",positive="+positive+")";
	//alert(obj.style.filter);
	}

 }
}


