// JavaScript Document

//open a pop-up window
function openWin(winObj,url,name,properties){}

var isNS6 = (document.getElementById)?true:false;
var newWin;

function Launch() {

	var xOff, yOff;
	var xSize = Launch.arguments[0]
	var ySize = Launch.arguments[1]
	var wURL = Launch.arguments[2];
	var scrollbars = Launch.arguments[3];
	var status = Launch.arguments[4];
	var winName = Launch.arguments[5];
			
	if(scrollbars == ''){
		scrollbars = 'yes';
	}
	if(status == ''){
		status = 'no';
	}

	if(winName == null || winName == ''){
		winName = 'Portal'+Math.floor(Math.random(1)*1000);
	}
	
	if(document.layers && navigator.userAgent.indexOf('WIN') == -1) {
		ySize = ySize + 45;
		xSize = xSize + 45;
	}
	else {
		if(navigator.appVersion.indexOf('4') != -1) {
			ySize = ySize + 45;
			xSize = xSize + 35;

		}
		else {
			ySize = ySize + 45;
			xSize = xSize + 35;			
		}
	}

	if (isNS6) {
		ySize = ySize + 10;
		xSize = xSize + 25;
	}

	xOff = Math.floor((screen.availWidth-xSize) / 2), yOff = Math.floor((screen.availHeight-ySize) / 2);	
	
//	alert(xSize+' , '+ySize+'\n@ '+xOff+' , '+yOff+'\nScreen size: '+screen.availWidth+' , '+screen.availHeight);
	newWin = window.open(wURL, winName, 'toolbar=0,location=0,status='+status+',width='+xSize+',height='+ySize+',top='+yOff+',left='+xOff+',scrollbars='+scrollbars);
	
}

function addFavourite(url, netscapeBookmark, otherBookmark){
	if( window.external && ( navigator.platform == 'Win32' || ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) {
    	//IE Win32 or iCab - checking for AddFavorite produces errors for no
    	//good reason, so I use a platform and browser detect.
    	//adds the current page page as a favourite; if this is unwanted,
    	//simply write the desired page in here instead of 'location.href'
    	if(url!='')
    		window.external.AddFavorite( url, document.title );
		else
			window.external.AddFavorite( location.href, document.title );
		
	} else if( document.layers || (window.sidebar && window.sidebar.addPanel)) { 
    	//NS4 & Escape & NS6 - tell them how to add a bookmark quickly (adds current page,
    	//not target page)
    	window.alert(netscapeBookmark);
	} else {
    	//other browsers - tell them to add a bookmark (adds current page, not target page)
    	window.alert(otherBookmark);
	}
}

function showHide(id){
	var obj = document.getElementById(id);
	if(obj.style.display == 'none' || obj.style.display == ''){
		obj.style.display='block';
	}
	else{
		obj.style.display='none';
	}
}

function showCardAction(aId) {
	showHide(aId);
}

function setEvent(aForm, aEvent) {
	document.forms[aForm].event.value = aEvent;
}

function setState(aForm, aState) {
	document.forms[aForm].state.value = aState;
}

function setEventAndState(aForm, aEvent, aState) {
	document.forms[aForm].event.value = aEvent;
	document.forms[aForm].state.value = aState;
}

