// $Id: common.js,v 1.4 2009/04/29 19:24:15 zander Exp $
var weePopUp = null;
function openWin( url , width , height, featureSwapList ){
	var fWidth = 810;
	if( width && width != "" ){
		fWidth = width;
	}
	var fHeight = 610;
	if( height && height != "" ){
		fHeight = height;
	}
	if(weePopUp){
		weePopUp = window.open('', 'weePopUp' , 'width=100,height=100,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no,left=1700,top=1700' );
		weePopUp.close();
		weePopUp = null;
	}
	var fToolbar = 'no';
	var fScrollbars = 'yes';
	var fStatus = 'yes';
	var fLocation = 'no';
	var fResizable = 'yes';
	var fMenubar = 'no';
	if(featureSwapList){
		featureSwapArray = featureSwapList.split(',');
		for(var i=0; i < featureSwapArray.length; i++){
			if(featureSwapArray[i] == "scrollbars"){fScrollbars = 'no';}
			if(featureSwapArray[i] == "toolbar"){fToolbar = 'yes';}
			if(featureSwapArray[i] == "status"){fStatus = 'no';}
			if(featureSwapArray[i] == "location"){fLocation = 'yes';}
			if(featureSwapArray[i] == "resizable"){fResizable = 'no';}
			if(featureSwapArray[i] == "menubar"){fMenubar = 'yes';}
		}
	}
	weePopUp = window.open(url , 'weePopUp' , 'width=' + fWidth + ',height=' + fHeight + ',toolbar='+ fToolbar +',location='+ fLocation +',directories=no,status='+ fStatus +',scrollbars='+ fScrollbars +',resizable='+ fResizable +',menubar='+fMenubar+',left=220,top=220' );
}

function wwAlert(str){
	$('<div title="Alert">'+str+'</div>').dialog({draggable:false, modal:true,resizable:false});
}

var navElement = null;
function navLink(elementId){
	if(!elementId){
		if(navElement){
			navElement.className = 'formatLinkNav';
			navElement = null;
		}
	} else{
		navElement = document.getElementById(elementId);
		if(navElement){
			navElement.className = 'formatLinkNav-over';
		}
	}
}

function confirmDelete(url,doubleCheck,msg){
	var message = "Permanently delete the selected item?";
	if(msg != null){
		message = msg;
	}
	if ( arguments.length == 1 ){
		doubleCheck = false;
	}
	if ( confirm( message ) ){
		if ( !doubleCheck || confirm( "Are you sure?" ) ){
			document.location.href = url;
		}
	}
}
