/*

	THIS PAGE WILL CONTAIN ALL THE JAVASCRIPTS NEEDED BY ALL PAGES

*/

//we will need this for the page popups
var popUpWidth = 780;
/*
var screenWidth = screen.width;
if(screenWidth > 999){
	popUpWidth = 960;
}
*/

//open a new window
function newWindow(urlString, windowName, properties) {
	window.open(urlString, windowName, properties + ",left=0,top=40");
}

//open a new window - standard internal page
function newWindowInt(urlString, windowName) {
	window.open(urlString, windowName, "width=780,height=480,scrollbars=yes,left=0,top=50");
}

//open a new window - standard winery page
function newWindowWin(urlString) {
	window.open(urlString, "winery", "width=" + popUpWidth + ",height=480,scrollbars=yes,left=0,top=50");
}

//open a new window in a new browser
function newBrowser(urlString) {
	window.open(urlString, "winery", "width=" + popUpWidth + ",height=480,location=yes, menubar=yes, resizable=yes, scrollbars=yes, status=yes,toolbar=yes,left=0,top=50");
}


//open a new window - standard external sites
function newWindowExtWin(urlString, windowName) {
	window.open(urlString, windowName, "width=560,height=350,resizable=yes,scrollbars=yes,left=0,top=180");
}

//open a new window - standard external sites
function newWindowExt(urlString, windowName) {
	window.open(urlString, windowName, "width=780,height=500,resizable=yes,scrollbars=yes,left=0,top=40");
}


//redirect to the search page
function doSearch(searchString) {
	document.location.href = "/search.aspx?search=" + searchString.value; 
}

//redirect to the search page - from forms section
function doSearchForms(searchString) {
	document.location.href = "../search.aspx?search=" + searchString.value; 
}

//redirect to the search page - from forms section
function doSearchApps(searchString) {
	document.location.href = "../../search.aspx?search=" + searchString.value; 
}


//redirect to the bio page
function doBio(bioIndex) {
	document.location.href = "../_bioPage.aspx?editorID=" + bioIndex; 
}

//open a new mailing window 
function emailWin(urlString) {
	window.open(urlString, "mailer", "width=500,height=450,resizable=no,scrollbars=no,left=10,top=50");
}



//this is the block for right clicking and copying
var message="Sorry our website doesn't support this.";

//this is for both new ie and netscape to catch enter on search
document.onkeypress = keyDown;

//this will help us figure out the browser
netscape = "";
ver = navigator.appVersion; len = ver.length;
for(iln = 0; iln < len; iln++) if (ver.charAt(iln) == "(") break;
netscape = (ver.charAt(iln+1).toUpperCase() != "C");

// handles keypress
function keyDown(DnEvents) { 
	// determines whether Netscape or Internet Explorer
	k = (netscape) ? DnEvents.which : window.event.keyCode;
	// enter key pressed
	if (k == 13 && document.forms[0].searchstring.value != "") { 
		
		doSearch(document.forms[0].searchstring);
		return false;
	}
}

//this is the right click code for some netscape versions
//document.oncontextmenu=new Function("alert(message);return false")

//ie right click stop
//function clickIE4(){
//	if (event.button==2){
//		alert(message);
//		return false;
//	}	
//}

//older netscape right click stop
//function clickNS4(e){
//	if (document.layers || document.getElementById && !document.all){
//		if (e.which==2 || e.which==3){
//			alert(message);
//			return false;
//		} else {
//			alert(message);
//			return false;
//		}
//	}
//}

//if we are netscape or ie
//if (document.layers){
//	document.captureEvents(Event.MOUSEDOWN);
//	document.onmousedown=clickNS4;
//} else if (document.all){
//	document.onmousedown = clickIE4;

//}

//send a message for temporarily blocked areas
function sendMessage(sectionName) {
	alert("Area in development.  Temporarily blocked.");
}	
