﻿/*
Software name: inyoni
Version: 1.5
Date: 4/16/2007
Author: Emlyn Addison
Copyright: (c) 2007 Emlyn Addison
Original portions of this code may not be modified, repackaged, resold, or redistributed without the express written permission of the author.
*/

function submitOrder(choiceQuantity) {
var choiceSet = 0;

	if (document.setform.choice) {
	
		for (var i = 0; i < document.setform.choice.length; i++) {
		
			if (document.setform.choice[i].checked == true) {
			document.orderform.choice.value = document.setform.choice[i].value;
			choiceSet = 1;
			break;
			}
		
		}
	
		if (!choiceSet) {
		alert('Please select your size.');
		return false;
		}
	
	}

	if (document.setform.discount) {
	document.orderform.discountcode.value = document.setform.discount.value;
	}

document.orderform.submit();
return true;
}

function popWindow(item){
var url = (item + '.php');

var newwindow = window.open(url,'browse','height=640,width=500,resizable,scrollbars=yes,toolbar=no,status=no,screenX=400,screenY=100,top=100,left=400');
				
	if (window.focus){
	newwindow.focus()
	}

}


/*
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
	
	Repurposed 7/28/2006
	Author: Emlyn Addison
	http://www.ixwa.com
*/

function initSwitch() {
	if (!document.getElementById) return
	
	var aImages = document.getElementsByTagName('img');
	var aPreLoad = new Array();

	for (var i = 0; i < aImages.length; i++) {		
		
		if (aImages[i].className == 'menubutton') {
		var src = aImages[i].getAttribute('src');
		var ftype = src.substring(src.lastIndexOf('.'), src.length);
		var imageOn = src.replace(ftype, '_on'+ftype);
		
		aImages[i].setAttribute('imageOn', imageOn);
		
		aPreLoad[i] = new Image();
		aPreLoad[i].src = imageOn;
		
			aImages[i].onmouseover = function() {
			defaultsrc = this.getAttribute('src');
			this.setAttribute('src', this.getAttribute('imageOn'));
			}	
			
			aImages[i].onmouseout = function() {
			if (!defaultsrc)
			defaultsrc = this.getAttribute('src').replace('_on'+ftype, ftype);
			this.setAttribute('src', defaultsrc);
			}
		
		}
		else if (aImages[i].className == 'browseimage') {
			var src = aImages[i].getAttribute('src');
			
			aImages[i].onmouseover = function() {
			document.body.style.cursor="pointer";
			window.status="Browse gallery image";
			return true;
			}	
			
			aImages[i].onmouseout = function() {
			document.body.style.cursor="default";
			window.status="";
			return true;
			}
			
			aImages[i].onclick = function() {
			bTempSrc = this.getAttribute('src');
			bTempName = this.getAttribute('name');
			var bsrc = bTempSrc.substring((bTempSrc.lastIndexOf('/')+1), bTempSrc.length);
			bsrc = bsrc.slice(0, -6);
			var url = ('display.php?image=' + bsrc + '&caption=' + bTempName);
			var newwindow = window.open(url,'display','height=640,width=500,resizable,scrollbars=yes,toolbar=no,status=no,screenX=400,screenY=100,top=100,left=400');
				
				if (window.focus){
				newwindow.focus()
				}

			}	
		
		
		}
	
	}

}

window.onload = initSwitch;

