var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
            && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav4up = (is_nav && (is_major >= 4));
var is_nav6up = (is_nav && (is_major >= 5));
var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_nav4 = (is_nav && (is_major == 4));	
var is_ie4up  = (is_ie && (is_major >= 4));
var is_dhtml = (is_ie4up || is_nav4up)

var tempX = 0, tempY = 0, overDiv = false;
	///////////////////////////////////////
	//RollOver Routines
	//Initialize variables
	var rollOverImages = new Array();
	var overIndicator = "_o";
	var layers = new Array();
	//Check for Rollover Capabilities
	//if (navigator.appName == "Netscape" && parseFloat(navigator.appVersion) >= 3.05 && document.images){roll=true;}
	//else if (navigator.appName == "Microsoft Internet Explorer" && parseFloat(navigator.appVersion) >= 3.02 && document.images){roll=true;}
	//Create New RollOver Object
	 //function createRollOver(img) {if (!rollOverImages[img.name] && document.images) rollOverImages[img.name] = new rollOver(img.src);}		
	//Function for Rollover On State
	//function imgOn(imgName) {if (document.images) document[imgName].src = rollOverImages[imgName].on.src;}
	//Function for Rollover Off State
	//function imgOff() {if (document.images) for (var Image in rollOverImages) document[Image].src = rollOverImages[Image].off.src;}
	//Constructor
	//function rollOver(on) {this.on = new Image();this.on.src = on.substring(0,on.lastIndexOf(".")) + overIndicator + on.substring(on.lastIndexOf("."),on.length);	this.off = new Image();this.off.src = on;}
	//////////////////////////////////////////

function BuildPopUp(name, content, width) {
	var popUp;
	layers[layers.length] = name;
	if (is_ie4up || is_nav6up) {popUp = '<SPAN ID="' + name + '" STYLE="width:' + width +';visibility:hidden;position:absolute;">' + content + '</SPAN>';}
	else {popUp = '<LAYER NAME="' + name + '" WIDTH="' + width +'" VISIBILITY="hide">' + content + '</LAYER>'}
	document.writeln(popUp)
	
}

	
function Popup(id){
	//if (sFileTrunk == 'home'){
		//alert('help');
		var cordX
		var cordY
		if (is_dhtml){
			for (layer in layers){
				if (id != layers[layer]){
					
					(is_ie4up)? overDiv = document.all[layers[layer]].style : (is_nav6up) ? overDiv = document.getElementById(layers[layer]).style : overDiv = document.layers[layers[layer]];
					(is_ie4up || is_nav6up) ? overDiv.visibility = "hidden" : overDiv.visibility = "hide";
					overDiv = false;
				}
			}
			if (id) {
				(is_ie4up)? overDiv = document.all[id].style : (is_nav6up) ? overDiv = document.getElementById(id).style : overDiv = document.layers[id];
				if (overDiv.visibility == "visible" || overDiv.visibility == "show") {
					(is_ie4up || is_nav6up) ? overDiv.visibility = "hidden" : overDiv.visibility = "hide";
					overDiv = false;
				}else{	
					(is_ie4up || is_nav6up) ? overDiv.visibility = "visible" : overDiv.visibility = "show";
				}
			}else{
				location.href=location.href;
			}
		}
	}
//}



function closePopup(id){ 
	var cordX
	var cordY
	if (is_dhtml){
		if (id) {
			//alert('id->' + id);
			(is_ie4up)? overDiv = document.all[id].style : (is_nav6up) ? overDiv = document.getElementById(id).style : overDiv = document.layers[id];
			(is_ie4up)? cordX += document.body.scrollWidth/2 : cordX += window.innerWidth/2;
			//tempX += 10;
			(is_ie4up || is_nav6up) ? overDiv.visibility = "hidden" : overDiv.visibility = "hide";
				overDiv = false;
				//imgOff();
		}else{
			location.href=location.href;
		}
	}
}


function scrShot(id, txt){
	if (navigator.appVersion.indexOf("MSIE")!=-1){
	document.write('<div class="popDiv" id="' + id + '">' +
		'<table border=0 cellpadding=2 cellspacing=0><tr><td bgcolor=#32598A>' +
			'<table border=0 cellpadding=3 cellspacing=0 bgcolor=#FFFFFF>' +
				'<tr><td class="HeaderNotSel">Feature View</td><td align=right><a href=# onClick="Popup(\'' + id + '\'); return false;">close</a></td></tr>' +
				'<tr><td colspan=2 bgcolor=#32598A style=padding:0px;><img src="Images/pixel.gif" width="1" height="1"></td></tr>' +
				'<tr><td colspan=2 class="Main">' + txt + '</td></tr>' +
				'<tr><td colspan=2 bgcolor=#32598A style=padding:0px;><img src="Images/pixel.gif" width="1" height="1"></td></tr>' +
				'<tr><td colspan=2><img src=Images/ScreenShots/' + id + '.gif name=img' + id + '></td></tr>');
					
		document.write('<tr><td colspan=2 align=right><b>View:</b> <a href=# onClick="imageSwap(\'img' + id + '\',\'Images/ScreenShots/' + id + '.gif\'); swapZoomColor(\''+ id +'\', 75); return false;" id="link75' + id + '">75%</a> | <a href=# onClick="imageSwap(\'img' + id + '\',\'Images/ScreenShots/' + id + '.jpg\'); swapZoomColor(\''+ id +'\', 100); return false;" id="link100' + id + '">100%</a></td></tr>');
	
	document.write('</table>' +
			'</td></tr></table>' +
		'</div>');
	swapZoomColor(id, 75);
	} else {
		window.open('Images/ScreenShots/' + id + '.gif', 'ScreenShot', '')
	}
}

function txtPop(id, txt){
	document.write('<div class="popDiv" id="' + id + '">' +
		'<table border=0 cellpadding=2 cellspacing=0><tr><td bgcolor=#32598A>' +
			'<table border=0 cellpadding=3 cellspacing=0 bgcolor=#FFFFFF>' +
				'<tr><td class="HeaderNotSel">Feature View</td><td align=right><a href=# onClick="Popup(\'' + id + '\'); return false;">close</a></td></tr>' +
				'<tr><td colspan=2 bgcolor=#32598A style=padding:0px;><img src="Images/pixel.gif" width="1" height="1"></td></tr>' +
				'<tr><td colspan=2 class="Main">' + txt + '</td></tr>' +
			'</table>' +
			'</td></tr></table>' +
		'</div>');
}
function scPopup(id, iWidth, iHeight) {
	//if (iWidth == "") {iWidth = "700"}
	//if (iHeight == "") {iHeight = "400"}
	//iWidth += 20
	//iHeight += 20
	window.open('screen_shot.php?id=' + id + '&w=' + iWidth + '&h=' + iHeight, 'ScreenShot', 'width='+iWidth+',height='+iHeight+',resizable=1,left=10,top=10,toolbar=no,status=no,scrollbars=no,menubar=no,location=no')	
}
function clrPopup(id, layerPrefix, layerHigh){
	//loop through the popups and make sure that all others are hiding
	//var i = 0
	//do{
	//	i++
	//	closePopup(layerPrefix + i)
	//}while(i < layerHigh);
	//Popup(id);
	window.open('Images/ScreenShots/' + id + '.jpg', 'ScreenShot', 'width=700,height=500,resizable=1,left=10,top=10,toolbar=no,status=no,scrollbars=no,menubar=no,location=no')
}



function swapZoomColor(sID, sZoom){
	if (sZoom == 75){
		document.getElementById('link75' + sID).style.color = "#C3C3C3"; 
		document.getElementById('link100' + sID).style.color = ""; 
	}
	if (sZoom == 100){
		document.getElementById('link75' + sID).style.color = ""; 
		document.getElementById('link100' + sID).style.color = "#C3C3C3"; 
	}
}
	