// 	Erica Wilson - Fashion General API(JavaScript)
// 	Author : EJFIIIWebDesign.com

//	Browser Brand Determination
	var isIE=false; var isNN=false; var isOP=false; isFF=false; 
	if (navigator.userAgent.indexOf("Opera")!=-1) isOP=true;
	if ((navigator.appName.indexOf("Microsoft")!=-1) && (navigator.userAgent.indexOf("Opera")==-1)) isIE=true;
	if (navigator.userAgent.indexOf("Firefox")!=-1) isFF=true;
	if ((navigator.appName.indexOf("Netscape")!=-1) && (navigator.userAgent.indexOf("Firefox")==-1)) isNN=true;

//	Reposition Content for Window Containers set Smaller than Content
// 	Necessary to prevent non-scrollable off screen content with negative margin style sheet centering method
	function checkVerticalPosition(page) {
	var viewWidth = 0, viewHeight = 0, contentWidth = 900, contentHeight = 700, posX = 0,  posY = 0;
	// 	Determine Available Window Size
  		if (isIE) {viewWidth = document.documentElement.clientWidth; viewHeight = document.documentElement.clientHeight;}
		else{viewWidth = window.innerWidth; viewHeight = window.innerHeight;} 
	// 	Set Content Window Coordinates
		if (viewWidth < 900) {document.getElementById('verticalPosition').style.left = 0+"px"; posX = 0;}
			else {posX = Math.floor((viewWidth-contentWidth)/2);}
		if (viewHeight < 700) {document.getElementById('verticalPosition').style.top = 360+"px"; posY = 0;}
			else {posY = Math.floor((viewHeight-contentHeight)/2);}
	// 	Apply New Window Coordinates
//		document.getElementById('content').style.left = posX+"px";
//		document.getElementById('content').style.top = posY+"px";
//		if (page != "home") document.getElementById('authorLink').style.top = posY+510+"px";
		}

//	Change Product Key Image Display
	function keyImageSwap(color) {
		document.getElementById("keyImage").src = "images/"+itemName+color+"_k.jpg";
		}

//	The following code was developed to prevent the "Select something" moniker from being submitted to the Cart.
//	Verify 'Add to Cart' Submission
	function validSelect(item) {
		selection = document.getElementsByName("os0")[item-1].value;
		if (selection != "None")  {document.forms[item].submit(); document.forms[item].reset();}
		else {alert("Please make your selection."); reset(); return;}		
		} 

// Set Default Window.Status Message
	window.defaultStatus="Erica Wilson - Voyager: The Cape and Islands Medallions";

// 	Variably adjust Opacity Settings for an Element
	function opacity(obj, opacStart, opacEnd, millisec) {
		var speed = Math.round(millisec / 100);	var timer = 0;
		if (opacStart > opacEnd) {
			for (i = opacStart; i >= opacEnd; i--) {
				setTimeout("changeOpac("+i+",'"+obj+"')", (timer * speed));
				timer++;
				}
		} else { if (opacStart < opacEnd) {
			for (i = opacStart; i <= opacEnd; i++) {
				setTimeout("changeOpac("+i+",'"+obj+"')", (timer * speed));
				timer++;
				}
			}
		}
	}

// 	Apply Transparency Setting to an Object
	function changeOpac(opacity, obj) {
		var object = document.getElementById(obj).style;
		object.opacity = (opacity / 100);
		object.MozOpacity = (opacity / 100);
		object.KhtmlOpacity = (opacity / 100);
		object.filter = "progid:DXImageTransform.Microsoft.alpha(opacity=" + opacity +")";
		}

