<!--

var applicationURL = 'https://secure.instalogo.com/logoMaker.html';
var applicationURL_ebay = 'https://secure.instalogo.com/ebay.html';
var applicationHeight = 575;
var applicationWidth = 800;

// browser compatibility
var isNS4 = (document.layers) ? true : false;
var isIE4 = (document.all && !document.getElementById) ? true : false;
var isIE5 = (document.all && document.getElementById) ? true : false;
var isNS6 = (!document.all && document.getElementById) ? true : false;

// ???? Who knows
function goURL(incURL){
	document.location.href = incURL;
}

// old function for handling logins (not used)
function Launch(page,user,pass){
	openNewWindow(page, "formProc", applicationHeight, applicationWidth);

	document.loginForm.username.value = user;
	document.loginForm.password.value = pass;

	document.loginForm.submit();
}

// this function is used in several places thoughout app to open pop-up windows
function openNewWindow(url,windowName,height,width,scrollbars){
	// calcs window center point
	var windowLeft = 0;
	var windowTop = 0;
	windowLeft = (screen.width - width) / 2;
	windowTop = (screen.height - height) / 2;

	if(!scrollbars){
		scrollbars = 0;
	}
	
	// fires window.open
	loadWindow = window.open(url,windowName,'height=' + height +',width=' + width + ',status=yes,toolbar=no,scrollbars=' + scrollbars + ',left=' + windowLeft + ',top='  +windowTop);
	loadWindow.focus();
	window.location.reload(0);
}

function tryIt(lmURL) {
	instaLogo = window.open(lmURL,"instaLogoWin","width=800,height=570");
	instaLogo.focus();
	window.location.reload(0);
}

// new login function (requires the presence of the MD5.js file for hex_md5() function call)
function processLogin(incUsername, incPassword, ebay){
	if(incUsername != ''){
		// gets md5 hash of input username and password
		loginUsername = hex_md5(incUsername.toLowerCase());
		loginPassword = hex_md5(incPassword.toLowerCase());
		if(ebay == true){
                        tempURL = applicationURL_ebay + '?loginUsername=' + loginUsername + '&loginPassword=' + loginPassword;
                        openNewWindow(tempURL, "formProc", applicationHeight, applicationWidth);
                        //alert('userName: '+ loginUsername);
                }else{
                     	tempURL = applicationURL + '?loginUsername=' + loginUsername + '&loginPassword=' + loginPassword;
                        openNewWindow(tempURL, "formProc", applicationHeight, applicationWidth);
                }
	}else{
		alert('Please provide a valid username');
	}
}

function determinehDiv(strDivName){
	//identify the element based on browser type
	if(isNS4){
		objElement = document.layers[strDivName];
	}else if(isIE4){
		objElement = document.all[strDivName];
	}else if(isIE5 || isNS6){
		objElement = document.getElementById(strDivName);
	}
	return objElement.style.visibility;
}

function switchDiv(strDivName,bolVisible){
	//identify the element based on browser type
	if(isNS4){
		objElement = document.layers[strDivName];
	}else if(isIE4){
		objElement = document.all[strDivName];
	}else if(isIE5 || isNS6){
		objElement = document.getElementById(strDivName);
	}
	
	// toggles the visibility of the div parameter
	if(!bolVisible){
		objElement.style.visibility = "hidden";
	}else{
		objElement.style.visibility = "visible";
	}
}

// sets up the keyboard listener
if(document.layers){
	document.captureEvents(Event.KEYPRESS);
}
document.onkeypress=processkey;

// this function handles the keyboard events
function processkey(e){
	// determines browser type
	if(!document.all){
		// Netscape
		key = e.which;
	}else{
		// IE
		key = window.event.keyCode;
	}
	my_char = String.fromCharCode(key);
	
	// handles the numbers 1-4 when pressed
	switch(key){
		// handle 'Enter' key press
		case 13:
			if(determinehDiv('loginBox') == 'visible'){
				processLogin(document.loginForm.username.value, document.loginForm.password.value);
			}
			break;
	}
}

function toggleLayer(whichLayer, theOtherOne)
{
	if (document.getElementById)
	{
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
		var style1 = document.getElementById(theOtherOne).style;
		style1.display = style1.display? "":"none";

	}
}
-->
