/* Browser/platform checkers */
if (navigator.userAgent.indexOf('MSIE') != -1)
{
	var isIE = true;
	var isNS = false;
	var isMoz = false;	
} 
else if (navigator.userAgent.indexOf('Netscape') != -1)
{
		var isNS = true;
		var isIE = false;
		var isMoz = false;		
}
else if (navigator.userAgent.indexOf('Mozilla') != -1)
{
		var isNS = false;
		var isIE = false;
		var isMoz = true;		
}

var isWin = navigator.userAgent.indexOf("Win") != -1;
var isMac = navigator.userAgent.indexOf("Mac") != -1;
var isUnix = navigator.userAgent.indexOf("X11") != -1;

/* Make a combo variable to identify */
var iBPmix = 0;
if (isWin)
{
	if (isIE)
	{
		iBPmix = 1;
	}
	if (isNS)
	{
		iBPmix = 2;
	}
	if (isMoz)
	{
		iBPmix = 5;
	}
}
if (isMac)
{
	if (isIE)
	{
		iBPmix = 3;
	}
	if (isNS)
	{
		iBPmix = 4;
	}
	if (isMoz)
	{
		iBPmix = 6;
	}
}

function showBig(picname, caption)
{
	var winID = window.open('/showpic.asp?pic=' + picname + '&cap=' + caption, 'bigpic', 'width=100,height=100,scrollbars=no,resizable=yes');
}

function showBigNoCap(picname)
{
	var winID = window.open('/showpic.asp?pic=' + picname, 'bigpic', 'width=100,height=100,scrollbars=no,resizable=yes');
}

function showBigNonGal(pageID, picNum)
{
	var winID = window.open('/showpic.asp?pid=' + pageID + '&pnum=' + picNum, 'bigpic', 'width=100,height=100,scrollbars=no,resizable=yes');
}

function showPopUp(page)
{
	var popUp = window.open( page, 'popup', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=yes,width=350,height=250');
}

function showPopUpWH(page, width, height)
{
	var popUp = window.open( page, 'popup', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=' + width + ',height='+ height);
}

function checkrequired( formname) {
var pass=0, box=0, theForm;
	theForm = document.forms[formname];
	
	if (document.images) {
		for (i=0; i < theForm.length; i++) {
			var tempobj=theForm.elements[i];
			if (tempobj.name.substring(0,1) == "*") {
						
				if (((tempobj.type=="text"||tempobj.type=="textarea")&&
				tempobj.value=='' )||(tempobj.type.toString().charAt(0)=="s"&&
				tempobj.selectedIndex==0)) {
					pass=1;
					break;
	      }
	    } 
		}
		
		if (pass==1) {		
			shortFieldName=tempobj.name.substring(1,30).toUpperCase();
			alert("Please make sure the "+shortFieldName+" field is properly filled in.");
			tempobj.focus();
		} else {
			theForm.submit();
		}
	}			
}

function process_imgs_links(img, caption) {
	if (isNS) { // handle NS
		document.bigimg.src = img;
		document.bigimg.alt = caption;
	} else if (isIE) { //handle IE
		document.all.bigimg.src = img;
		document.all.bigimg.alt = caption;
	} else { // Handle Mozilla
		document.getElementById("bigimg").src = img;
		document.getElementById("bigimg").alt = caption;
	}
}
function xxprocess_imgs_links(img, caption)
{
	alert(document.getElementById('bigimg').src);
}

function setFocusOn( sform, sfield) {
	var sForm = document.forms[sform];
	sForm.elements[sfield].focus();
}

function showPageFlash(file, width, height, insertIntoId, nonFlashFunc)
{
	if ( !is_flash || (flash_ver < 7) )
	{
		if (nonFlashFunc)
		{ nonFlashFunc(file, width, height, insertIntoId); }
	}
	else
	{
		var innerGallery;
		if (document.getElementById(insertIntoId)) 
		{ innerGallery = document.getElementById(insertIntoId); }
		else
		{ innerGallery = document.getElementById("pageflash"); }

		innerGallery.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + width + '" height="' + height + '">'
    	+ '<param name="movie" value="' + file + '">'
      + '<param name="quality" value="high">'
      + '<embed src="' + file + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>'
     + '</object>';
	}
}
function trace(s){
	if(!document.getElementById('mediadebug')){
		this.document.body.innerHTML  +='<div id="mediadebug" style="position:absolute; top:1px; left:1px; width:200px;height:100px;border:1px solid red; background-color:#666666;overflow:auto;" onclick="this.style.visibility=\'hidden\';">Media Debugger:</div>'; 			
	}
	var mediadebug = document.getElementById('mediadebug')
	mediadebug.style.visibility='visible';
	mediadebug.innerHTML += '<br/>' + s;		
}
