<!--
  
preloadImages('images/menu01b.gif', 'images/menu01d.gif',
	          'images/menu02b.gif', 'images/menu02d.gif',
	          'images/menu03d.gif', 'images/menu05a.gif',
	          'images/menu04b.gif', 'images/menu07b.gif');

var current_show = '';
var click_msg;

function checkQuantityMin(iUserInputQuantity, iInputMin){
    if(iUserInputQuantity < iInputMin){
		alert ('Please Enter ' + iInputMin + " or More Items.");
		return false;
	} else {
		return true;
	}
}

function validateEmailAddress(email) {
	return (email.lastIndexOf(".") > 2) && (email.indexOf("@") > 0);	
}

function validateUsername(username) {
	return username.length > 3;
}

function validatePassword(pass1, pass2) {
	return pass1.length > 1 && pass1 == pass2;
}

function validateRegistration(f) {
	if ( !validateEmailAddress(f.ship_email.value) ) {
		window.alert("Invalid shipping email address entered.");
		return false;
	}
	if ( !validateEmailAddress(f.bill_email.value) ) {
		window.alert("Invalid billing email address entered.");
		return false;
	}
	if ( !validateUsername(f.new_username.value) ) {
		window.alert("Invalid username entered.");
		return false;
	}
	if ( !validatePassword(f.new_password.value, f.new_password_repeat.value) ) {
		window.alert("Passwords do not match.");
		return false;
	}
	return true;
}

function validateCC(f) {
    if ( f.cc_type.value == 0 ) {
        alert("Please enter a credit card type.");
        return false;
    }
    if ( !f.cc_number.value ) {
        alert("Please enter a credit card number.");
        return false;
    }
    if ( !f.cc_exp_month ) {
        alert("Please enter a credit card expiry month.");
    }
    if ( !f.cc_exp_yr ) {
        alert("Please enter a credit card expiry year.");
    }
    return true;
}

function HighlightMenuElement(e) {
    e.style.backgroundColor = '#ffffff';
    e.style.color = '#000099';
    for(i=0; i<e.children.length; i++) {
        e.children[i].style.color = '#000099';
    }
}

function UnHighlightMenuElement(e) {
    e.style.backgroundColor = '#0A0A78';
    e.style.color = '#ffffff';
    for(i=0; i<e.children.length; i++) {
        e.children[i].style.color = '#ffffff';
    }
}

function ShowMenu(menu, parent_menu) {
    // IE 5.0+
    if (is_ie5up) {
		var l=document.all.tags("DIV");
		for (i=0; i < l.length; i++){
	    	if ( l[i].name && l[i].name != menu ) {
				l[i].style.visibility="hidden";
	    	}
		}
        document.all(menu).style.visibility = 'visible';
    }
    // NS4
    else if (is_nav4) {
        current_show = menu;
		// First make all other "sub" layers hidden
        var regexp = /^sub/;
		for(i=0; i<document.layers.length; i++) {          
            if ( document.layers[i] != document.layers[menu] && regexp.test(document.layers[i].name) ) {
	    	    document.layers[i].visibility = 'hide';
            }
		}
        document.layers[menu].top = 90;
        document.layers[menu].visibility = 'show';
    }
    // NS6+, Mozilla
    else if (is_gecko) {
        if (!is_moz)
            current_show = menu;
        document.getElementById(menu).style.visibility = 'visible';
        // Make other sub-menus hidden!
        var l = document.getElementsByTagName("DIV");
        var regexp = /^sub/;       
        for(i=0; i<l.length; i++) {
            var cl = l[i].getAttribute('class');
            var id = l[i].getAttribute('id');
            if ( cl && cl == "sub_menu" && id && regexp.test(id) && id != menu )
                l[i].style.visibility = "hidden";
		}        
    }
    else {
        alert("unsupported?");
    }
}


function HideMenu(menu) {
    // NS 4 or 6 only, we need to delay a bit
    if (is_nav4 || (is_nav6 && !is_moz)) {
		setTimeout("HideMenuNow('"+menu+"')",800);
    }
    else {
		HideMenuNow(menu);
    }	
}


function HideSubMenu(menu) {
    current_show = '';
    if (is_nav4 || (is_nav6 && !is_moz)) {
        setTimeout("HideMenuNow('"+menu+"')",800);
    }
    else {
        HideMenuNow(menu);
    }
}


function SetCurrentShow(string) {
    current_show = string;
}


function HideMenuNow(menu) {
    //alert("hiding "+menu+ " curr: " + current_show);
    // IE 5.0+
    if (is_ie5up) {
        document.all(menu).style.visibility = 'hidden';
    }
    // NS4
    else if (is_nav4) {
		// Since Netscape sucks, don't hide.. only hide when Making visible (above)
        if ( menu && current_show != menu )
           document.layers[menu].visibility = 'hide';
    }  
    // NS7+, Mozilla 1.2+, Etc
    else if (is_moz) {
		document.getElementById(menu).style.visibility = 'hidden';
    }
    // NS6
    else if (is_nav6) {  
        if ( !menu ) {
            var l = document.getElementsByTagName("DIV");
            var regexp = /^sub/;
        
            for(i=0; i<l.length; i++) {
                var cl = l[i].getAttribute('class');
                var id = l[i].getAttribute('id');
                if ( cl && cl == "sub_menu" && id && regexp.test(id) && id != menu )
	    			l[i].style.visibility = "hidden";
		    }
        }
        if ( current_show != menu )
	        document.getElementById(menu).style.visibility = 'hidden';
    }
    else {
        alert("hidemenunow");
    }
}

function viewPosterDesign(url) {
    window.open(url, '', 'scrollbars=no,width=550,height=575');
}

function Popup(url) {
    window.open(url, '', 'scrollbars=yes,width=400,height=300');
}


function PopupOnAboutPage(url) {
    window.open(url, '', 'scrollbars=yes,width=700,height=400');
}


function PopupGifHR(url) {
    window.open(url, '', 'scrollbars=yes,width=1300,height=1300');
}

function Alert(url) {
    if ( url ) {
	window.open(url, '', 'scrollbars=yes,width=400,height=400');
    }
}

// Functions compliments of Macromedia Dreamweaver :)

function swapImgRestore() {
    var i, x, a=document.MM_sr;
    for (i=0; a&&i<a.length&&(x=a[i])&&x.oSrc; i++)
	x.src = x.oSrc;
}


function preloadImages() {
    var d=document;
    if (d.images) {
	if (!d.MM_p)
	    d.MM_p=new Array();
	var i, j=d.MM_p.length, a=preloadImages.arguments;
	for (i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0) {
		    d.MM_p[j]=new Image;
		    d.MM_p[j++].src=a[i];
        }
    }
}


function findObj(n, d) {
    var p,i,x;
    if(!d)
	    d=document;
    if ( (p=n.indexOf("?"))>0&&parent.frames.length ) {
	    d = parent.frames[n.substring(p+1)].document;
	    n = n.substring(0,p);
    }
    if ( !(x=d[n])&&d.all)
	    x = d.all[n];
    for (i=0; !x&&i<d.forms.length; i++)
    	x = d.forms[i][n];
    for (i=0; !x&&d.layers&&i<d.layers.length; i++)
    	x = findObj(n,d.layers[i].document);
    return x;
}


function swapImage() {
    var i, j=0, x, a=swapImage.arguments;
    document.MM_sr = new Array;
    for (i=0; i<(a.length-2); i+=3)
	    if ( (x=findObj(a[i]))!=null ) {
	        document.MM_sr[j++]=x;
    	    if (!x.oSrc)
    		x.oSrc=x.src;
    	    x.src=a[i+2];
	    }
}

function preview(url, width, height) {
    width  = width  ? width  : 500;
    height = height ? height : 500;
    var rwh = "resizable=yes,width="+width+",height="+height;
    window.open(url, '', rwh);
}

function popup(url, width, height, scroll) {
    width  = width  ? width  : 500;
    height = height ? height : 500;
    scroll = scroll == 'yes' ? 'yes'    : 'no';
    var rwh = "resizable=yes,scrollbars="+scroll+",width="+width+",height="+height;
    window.open(url, '', rwh);
}

function parentGo(page) {
    opener.location.href = page;
    window.close();
}


function setCursorOnField(field_name) {
    if (document.forms.length < 1)
        return;
    var num_forms = document.forms.length;  
    for (i=0; i<num_forms; i++) {
        for (j=0; j<document.forms[i].length; j++) {
            if ( document.forms[i].elements[j].name == field_name )
                document.forms[i].elements[j].focus();
                return;
        }
    }
}


function posterJump(targ,selObj,type){ 
  var id   = selObj.options[selObj.selectedIndex].value;
  //alert("id is "+id+" type is "+type);
  if ( id == "#")
    return false; 
  //var url = targ+".location='"+PosterSelect.php?typ+"'";
  var url = "PosterSelect.php?category_id="+id+"&type="+type;
  if ( document.poster_jump.PHPSESSID ) {
    var sid = document.poster_jump.PHPSESSID.value;
    if (sid) url += "&PHPSESSID=" + sid;
  }
  //alert(url);
  eval(targ+".location='"+url+"'");
}


function pageLoadFunctions() {
    setCursorOnField('username');
    document.onContextMenu = new Function("return false");
}

var click = "";

function noClickIE() 
{
   if (is_ie) {
      (click);
      return false;
   }
}

function noClickNS(e) 
{
   if (!is_ie) {
      if (e.which==2 || e.which==3) {
         (click);
         return false;
      }
   }
}

if (!is_ie) {
   document.captureEvents(Event.MOUSEDOWN);
   document.onmousedown = noClickNS;
}
else {
   document.onmouseup     = noClickNS;
   document.oncontextmenu = noClickIE;
}

document.oncontextmenu=new Function("return false")

//-->

