                function per_page_1() {
                        per    = document.res_per_page_1.num.options[document.res_per_page_1.num.selectedIndex].value;
                        cat_id = document.res_per_page_1.cat_id.value;
                        sub_id = document.res_per_page_1.sub_id.value;
                        location.href = "subcategory?per_page=" + per + "&sub_id=" + sub_id + "&cat_id=" + cat_id; 
                        return true;
                }
                function per_page_2() {
                        per    = document.res_per_page_2.num.options[document.res_per_page_2.num.selectedIndex].value;
                        cat_id = document.res_per_page_2.cat_id.value;
                        sub_id = document.res_per_page_2.sub_id.value;
                        location.href = "subcategory?per_page=" + per + "&sub_id=" + sub_id + "&cat_id=" + cat_id; 
                        return true;
                }

                function select_filter(cat_id,sub_id) {
                        URL = new String( document.location );
                        vars = URL.split("/");
                        page = vars[3].substring(0,11);
                        if( page == 'subcategory' ){ file = page; }
                        page2 = vars[3].substring(0,13);
                        if( page2 == 'tags_reg_mark' ){ file = page2; }
                        page3 = vars[3].substring(0,19);
                        if( page3 == 'tags_clearance_mark' ){ file = page3; }

                        stock_id = document.filter.filter_stock.options[document.filter.filter_stock.selectedIndex].value;
                        location.href = file + "?cat_id=" + cat_id + "&sub_id=" + sub_id + "&filter_stock=" + stock_id;
                        return true;
                }


	function MM_findObj(n, d) { //v3.0
		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=MM_findObj(n,d.layers[i].document); return x;
	}
		
	function MM_swapImgRestore() { //v3.0
		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 MM_swapImage() { //v3.0
		var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	
	function MM_displayStatusMsg(msgStr) { //v1.0
		status=msgStr;
		document.MM_returnValue = true;
	}

	function gotoInNash(){
		gotoURL = getURL(document.LocForm.inNash);
		if (gotoURL !== ""){
			location.href = gotoURL;
		}
	}	

	function gotoInMTN(){
		gotoURL = getURL(document.LocForm.inMTN);
		if (gotoURL !== ""){
			location.href = gotoURL;
		}
	}

	function PopupNoShip(msgtext){
		url='noship?man_msgtext=' + msgtext;
		window.open(url,'noship','height=170,width=370');
	}
	
	//pull the value out of combo box
	function getURL(o){
		for (i=0; i<o.length; i++){
			if (o[i].selected == true){
				return o[i].value;
			}
		}
		return "";
	}

	function Avail(Am,Ay) {
		var AvailableMonth=Am;
		var AvailableYear=Ay;
		var months=new Array(12)
		months[0]="Jan.";months[1]="Feb.";months[2]="Mar.";months[3]="Apr.";months[4]="May";months[5]="June";months[6]="July";months[7]="Aug.";months[8]="Sept.";months[9]="Oct.";months[10]="Nov.";months[11]="Dec.";
		function datecountdown(yr,m){
		var today=new Date()
		var todayy=today.getYear()
		var todaym=today.getMonth()
		if ( (yr > todayy) || ((yr == todayy) && (m >= todaym)) )
			document.write('<li><b>Available '+months[m]+' '+AvailableYear+'</b>')}
		datecountdown(AvailableYear,AvailableMonth-1)
	}

	function CheckMyInput() {
		var name = document.app.Fname.value;
		if( name.length == 0 ) {
			alert("Please fill the Name Field!");
			return false; }
	}

	function callSubmit()
	{
	   document.frmApplicationTermsCond.submit();
	}

function check_bill( check ){
alert (check.value);
	if( check.value ){
		showLayers('billing');
	} else { showLayers('nobilling'); }
}

/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2001-3 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

// onresize for ns4
var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

var cur_lyr; // holds id of currently visible layer
function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}


function check_pri_phone_1() {
	var digits_pri_1 = document.create_account.pri_phone_1.value.length + 1;
	if( digits_pri_1 <= 3 ){ document.create_account.pri_phone_1.focus(); }
	else{ document.create_account.pri_phone_2.focus(); }
}
function check_pri_phone_2() {
	var digits_pri_2 = document.create_account.pri_phone_2.value.length + 1;
	if( digits_pri_2 <= 3 ){ document.create_account.pri_phone_2.focus(); }
	else{ document.create_account.pri_phone_3.focus(); }
}

function check_alt_phone_1() {
	var digits_alt_1 = document.create_account.alt_phone_1.value.length + 1;
	if( digits_alt_1 <= 3 ){ document.create_account.alt_phone_1.focus(); }
	else{ document.create_account.alt_phone_2.focus(); }
}
function check_alt_phone_2() {
	var digits_alt_2 = document.create_account.alt_phone_2.value.length + 1;
	if( digits_alt_2 <= 3 ){ document.create_account.alt_phone_2.focus(); }
	else{ document.create_account.alt_phone_3.focus(); }
}

function submit_form() { document.product.submit(); }
