
var lastMouseX;
var lastMouseY;
var curPopupWindow = null;
	
function manualSubmit(action) {
	var f = document.forms[0];
	f.action = action
	f.submit();
}

function mouseCursor(cursor) {  var el = event.srcElement;
	switch (cursor) {
		case "hand":
			el.style.cursor = "hand";
			break
		default:
			el.style.cursor = "default";
	}
}

// cross browser compatible
function changeCursor(cursor, evt) {	evt = (evt) ? evt : event;  var el = (evt.target) ? evt.target : event.srcElement;

	switch (cursor) {
		case "hand":
			el.style.cursor = "pointer"; // for modzilla, don't change order
			el.style.cursor = "hand"; // for ie
			break
		default:
			el.style.cursor = "";
	}
}

function openPopup(url, name, width, height, features, snapToLastMousePosition) {
  closePopup();
	if (snapToLastMousePosition) {
		if (lastMouseX - width < 0) lastMouseX = width;
		if (lastMouseY + height > screen.height) 	lastMouseY -= (lastMouseY + height + 50) - screen.height;	
    lastMouseX -= width;
    lastMouseY += 10;
		features +=	"screenX=" + lastMouseX + ",left=" + lastMouseX + "screenY=" + lastMouseY + ",top=" + lastMouseY;
	}
	curPopupWindow = window.open(url, name, features, false);
}

function setLastMousePosition(evt) {
	evt = (evt) ? evt : event;
	lastMouseX = evt.screenX;
	lastMouseY = evt.screenY;
}

function closePopup() {
	if (curPopupWindow != null) {
		if (!curPopupWindow.closed)	curPopupWindow.close();
		curPopupWindow = null;
	}
}

function popUp_Scroll(url, name, width, height) {
	openPopup(url, name, width, height, "width=" + width + ",height=" + height + ",dependent=no,resizable=yes,toolbar=no,status=yes,directories=no,menubar=no,scrollbars=1", false);
}

function popUp(url, name, width, height) {
	openPopup(url, name, width, height, "width=" + width + ",height=" + height + ",dependent=no,resizable=yes,toolbar=no,status=no,directories=no,menubar=no,scrollbars=0", false);
}

function popUp_Snap(url, name, width, height) {
	openPopup(url, name, width, height, "width=" + width + ",height=" + height + ",dependent=no,resizable=yes,toolbar=no,status=no,directories=no,menubar=no,scrollbars=0", true);
}

// -- CUSTOM FUNCTIONS ---------------------------------------------------------------------------</>-

// Absolute Div Close Funtion
//this version doesn't block out the flash links on home pages when it's hidden
//use showlinkSize function below if you close the div using this version.

function hidelink(layername) {
    if (layername.style.visibility == "visible") {
        layername.style.visibility = "hidden";
        layername.style.top = "-9999px";
        layername.style.height = "0px";
        layername.style.width = "0px";
    }
    else {
        layername.style.visibility = "hidden";
        layername.style.top = "-9999px";
        layername.style.height = "0px";
        layername.style.width = "0px";
    }
}

// Div pop up Funtion
//needs input parameters to set size and distace to restore placement - if closed using the close script above, it has moved it off screen.
//call like this: showlinkSize(document.getElementById('Promo2'), '150px', '640px', '260px')
function showlinkSize(layername, topUnit, divWidth, divHeight) {
    if (layername.style.visibility == "hidden") {
        layername.style.visibility = "visible";
        layername.style.top = topUnit;
        layername.style.height = divHeight;
        layername.style.width = divWidth;
    }
    else {
        layername.style.visibility = "visible";
        layername.style.top = topUnit;
        layername.style.height = divHeight;
        layername.style.width = divWidth;
    }
}
// Div pop up Funtion

function showlink(layername) {
    if (layername.style.visibility == "hidden")
        layername.style.visibility = "visible"
    else
        layername.style.visibility = "visible"
}

// Absolute Div Close Funtion

function login() {

    if (document.forms[0].Password.value == "dash80"){
        switch (document.forms[0].Company.value) {
            case 'Boeing': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-boeing"; break }
            case 'Eddie Bauer': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-eddiebauer"; break }
            case 'Microsoft': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-microsoft"; break }
            case 'Nordstrom': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-nordstrom"; break }
            case 'RecSport': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-recsport"; break }
            case 'Weyerhauser': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-weyerhauser"; break }
            case 'WHCA Members': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-whca"; break }
            case 'XYLO': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-xylo"; break }
            case 'Spacelabs Healthcare': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-spacelabs"; break }
            case 'HP': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-hp"; break }
            case 'Franciscan Health System': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-franciscan"; break }
            case '5th Cell': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-5thcell"; break }
            case 'Windermere': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-windermere"; break }
            case 'ReMax': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-remax"; break }
            case 'ZymoGenetics': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-zymogenetics"; break }
            
            case 'Intel': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-intel"; break }
            case 'Microvision': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-microvision"; break }
            case 'razorfish': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-razorfish"; break }
            case 'infospace': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-infospace"; break }
            case 'Oracle': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-oracle"; break }
            case 'Coldwell Banker': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-coldwell"; break }
            case 'John L. Scott': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-johnlscott"; break }
            case 'Harborstone': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-harborstone"; break }
            case 'UIEvolution': { window.location.href = "default.aspx?html=buyingprograms.html&s=buying-uievolution"; break }
                                           
            default: document.getElementById("msg").innerHTML = "<b><font color='#cccccc'>You must select a company! Please Try Again:</font></b><br>";
        }
    }


    else
        document.getElementById("msg").innerHTML = "<b><font color='#cccccc'>Invalid Password! Please Try Again:</font></b><br>";
}
