
/* 
Derived from a script by Alejandro Gervasio. 
Modified to work in FireFox by Stefan Mischook for Killersites.com

How it works: just apply the CSS class of 'column' to your pages' main columns.
*/
matchColumns=function(){ 

     var divs,contDivs,maxHeight,divHeight,d; 
	
     // get all <div> elements in the document 

     divs=document.getElementsByTagName('div'); 

     contDivs=[]; 

     // initialize maximum height value 

     maxHeight=0; 

     // iterate over all <div> elements in the document 

     for(var i=0;i<divs.length;i++){ 

          // make collection with <div> elements with class attribute 'container' 

          if(/\bcolumn\b/.test(divs[i].className)){ 

                d=divs[i]; 

                contDivs[contDivs.length]=d; 

                // determine height for <div> element 

                if(d.offsetHeight){ 

                     divHeight=d.offsetHeight; 					

                } 

                else if(d.style.pixelHeight){ 

                     divHeight=d.style.pixelHeight;					 

                } 

                // calculate maximum height 

                maxHeight=Math.max(maxHeight,divHeight); 

          } 

     } 

     // assign maximum height value to all of container <div> elements 

     for(var i=0;i<contDivs.length;i++){ 

          contDivs[i].style.height=maxHeight + "px"; 

     } 

} 

// Runs the script when page loads 

window.onload=function(){ 

     if(document.getElementsByTagName){ 

          matchColumns();

     } 

} 


function resize_pic() {
	
      if (window.innerWidth) {
		  
		     iWidth = window.innerWidth;
             iHeight = window.innerHeight;
			 
      } else {
		  
              iWidth = document.body.clientWidth;
              iHeight =document.body.clientHeight;
      }
              iWidth = document.images[0].width - iWidth;
              iHeight = document.images[0].height - iHeight;
              window.resizeBy(iWidth, iHeight);

}

function resize_win() {
		  
       //iWidth = document.body.clientWidth;
      // iHeight =document.body.clientHeight;
     
       iWidth = document.images.pic.width + document.images.thumb.width;
	   iHeight = document.images.pic.height + document.images.thumb.height;
       window.resizeTo(iWidth,iHeight);
	   self.moveTo((screen.width - iWidth) / 2,(screen.height - iHeight) / 2);
}

function update_cart() {
	document.viewcart.cart_mode.value = "update";
}

function checkout() {
	document.viewcart.cart_mode.value = "checkout";
}

function grabCustomerInfo() {
	if(document.customer_info.sameAsCustomer.checked) {

		/*if (document.customer_info.customer_address.value == "" || 
			document.customer_info.customer_city.value == "" || 
			document.customer_info.customer_state.value == "" || 
			document.customer_info.customer_zip.value == "" ||
			document.customer_info.customer_phone == "") {
			alert ('Some information fields in personal information are empty.');
			
		} else {*/
	
		document.customer_info.shipping_address.value = document.customer_info.customer_address.value;
		document.customer_info.shipping_address2.value = document.customer_info.customer_address2.value;
		document.customer_info.shipping_city.value = document.customer_info.customer_city.value;
		document.customer_info.shipping_state.selectedIndex = document.customer_info.customer_state.selectedIndex;
		document.customer_info.shipping_zip.value = document.customer_info.customer_zip.value;
		document.customer_info.shipping_phone.value = document.customer_info.customer_phone.value;
		document.customer_info.shipping_fax.value = document.customer_info.customer_fax.value;
	
		//}

	} else {
		document.customer_info.shipping_address.value = "";
		document.customer_info.shipping_address2.value = "";
		document.customer_info.shipping_city.value = "";
		document.customer_info.shipping_state.selectedIndex = 0;
		document.customer_info.shipping_zip.value = "";
		document.customer_info.shipping_phone.value = "";
		document.customer_info.shipping_fax.value = "";
	
	}
}


//fold cc info

imgout=new Image(9,9);
imgin=new Image(9,9);

/////////////////BEGIN USER EDITABLE///////////////////////////////
	imgout.src="";
	imgin.src="";
///////////////END USER EDITABLE///////////////////////////////////

//this switches expand collapse icons
function filter(imagename,objectsrc){
	if (document.images){
		document.images[imagename].src=eval(objectsrc+".src");
	}
}

//show OR hide funtion depends on if element is shown or hidden
function show_hide(id) { 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = 'block';
			//filter(("img"+id),'imgin');			
		} else {
			//filter(("img"+id),'imgout');
			document.getElementById(id).style.display = 'none';			
		}	
	} else { 
		if (document.layers) {	
			if (document.id.display == "none"){
				document.id.display = 'block';
				//filter(("img"+id),'imgin');
			} else {
				//filter(("img"+id),'imgout');	
				document.id.display = 'none';
			}
		} else {
			if (document.all.id.style.visibility == "none"){
				document.all.id.style.display = 'block';
			} else {
				//filter(("img"+id),'imgout');
				document.all.id.style.display = 'none';
			}
		}
	}
}

function show(id) { 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
			document.getElementById(id).style.display = 'block';
			//filter(("img"+id),'imgin');			
	} else { 
		if (document.layers) {	
				document.id.display = 'block';
				//filter(("img"+id),'imgin');
		} 

	}
}


function hide(id) { 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
			document.getElementById(id).style.display = 'none';
			//filter(("img"+id),'imgin');			
	} else { 
		if (document.layers) {	
				document.id.display = 'none';
				//filter(("img"+id),'imgin');
		} 

	}
}


//end folding

function popUp(theURL, Name, popW, popH, scroll) { 
		var winleft = (screen.width - popW) / 2;
		var winUp = (screen.height - popH) / 2;
		winProp = 'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scroll+',resizable'
		Win = window.open(theURL, Name, winProp)
		if (parseInt(navigator.appVersion) >= 4) { Win.window.focus(); }
	}

function Delete(msg){
	x = window.confirm(msg);
		
	if (x) {
		return true;
	} else {
		return false;
	}
}

function mOvr(src,clrOver) {
    if (!src.contains(event.fromElement)) {
	  src.style.cursor = 'hand';
	  src.bgColor = clrOver;
	}
  }
function mOut(src,clrIn) {
	if (!src.contains(event.toElement)) {
	  src.style.cursor = 'default';
	  src.bgColor = clrIn;
	}
  }
function mClk(src) {
    document.location.href=src;
	/*if(event.srcElement.tagName=='TR'){
	   src.children.tags('A')[2].click();
    }*/
  }