// JavaScript Document
function qtycheck() {
var attribute_0 = document.getElementById('attribute_0').value;
var qty = document.getElementById('qty').value;
         if (document.getElementById('qty').value == 1)
         {
			 if (document.getElementById('attribute_0').value == 91)
         {	alert("You must order more the 1 puzzle to get this discount")
            return false;
         	}
		 }
      
}

function changeText(){
	var attribute_0 = document.getElementById('attribute_0').value;
	if (document.getElementById('attribute_0').value == 91){
	document.getElementById('qty').value = 2;
	}else{
		(document.getElementById('attribute_0').value == 90)
	document.getElementById('qty').value = 1;
	}	
}

function changeText91(){
	var attribute_0 = document.getElementById('attribute_0').value;
	document.getElementById('qty').value = 2;
}
function changeText90(){
	var attribute_0 = document.getElementById('attribute_0').value;
	document.getElementById('qty').value = 1;
}

function toggleMe(targetId){
	if (document.getElementById){
		target = document.getElementById( targetId );
		if (target.style.display == "none"){
				target.style.display = "";
		} else {
			target.style.display = "none";
		}
	}	 
}
 
 
function adminToggle(targetId,arrowId){
	if (document.getElementById){
		target = document.getElementById( targetId );
		flipper = document.getElementById( arrowId );
		if (target.style.display == "none"){
				target.style.display = "";
				flipper.style.background = "url(images/downarrow.png)";
		} else {
			target.style.display = "none";
			flipper.style.background = "url(images/rightarrow.png)";
		}
	}	 
}

function swapimage(newimage)
   {
   
   	newimage = "ximages/m/" + newimage;
   	
      var imgMain = document.getElementById('mainimage');
      var divParent;

      // create new image element
      var imgNew = document.createElement('img');

      // give it an image
      // here I use the src of the icon just for convenience
      // you'd want to somehow determine the src of your desired image
      imgNew.src = newimage;
   
      // give it an id
      imgNew.id = 'mainimage';

      // replace image
      divParent = imgMain.parentNode;
      divParent.replaceChild(imgNew, imgMain);

}         

