var popUpWin=0;

//
// Hides/Shows a DIV
//
function toggleDIV(myDiv) {
	var ele = document.getElementById(myDiv);
	if(ele.style.display == "block") {
   		ele.style.display = "none";
	}
	else {
		ele.style.display = "block";
	}
} 

function popUpWindow(URLStr, left, top, width, height)
{
	if(popUpWin)
	{
		if(!popUpWin.closed) popUpWin.close();
	}
  	var left = parseInt((screen.availWidth/2) - (width/2));
  	var top = parseInt((screen.availHeight/2) - (height/2));
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	popUpWin.focus();
}
function UpdateWindow() {
	window.location.reload(true);
	//window.location.pathname;
}
function closeWindow() {
		opener.UpdateWindow();
		window.close();
}

function ConfirmCopy(sRecordName, sLocation, nWidth, nHeight)
{
    var sMessage;
	
	sMessage = "Copy Article: " + sRecordName + "?";    
    if(confirm(sMessage) != 0) {
		popUpWindow(sLocation, 0, 0, nWidth, nHeight);
		//window.location=sLocation;
	}
	return false;
}

function ConfirmDelete(sRecordName, sLocation, nWidth, nHeight)
{
    var sMessage;
	
	sMessage = "Confirm deletion of " + sRecordName + "?";    
    if(confirm(sMessage) != 0) {
		popUpWindow(sLocation, 0, 0, nWidth, nHeight);
		//window.location=sLocation;
	}
	return false;
}
/*
 * Jumps to a URL defined by the drop selection...
 */
function jumpMenu2()
{ 
	var newIndex = genre.jumpmenu.selectedIndex;
	
	if ( newIndex == 0 ) { 
		alert( "Please select a location!" ); 
	} else { 
		cururl = genre.jumpmenu.options[ newIndex ].value; 
		window.location.assign( cururl ); 
	} 
} 
function Left(str, n)
{
   if (n <= 0)
         return "";
   else if (n > String(str).length)
         return str;
   else
         return String(str).substring(0,n);
}
