var pdomidl = 10;
var pdomid= new Array();
pdomid['productcode']=Array();
pdomid['mancode']=Array();
pdomid['shortdesc']=Array();
pdomid['desci']=Array();
pdomid['price']=Array();
pdomid['rprice']=Array();
pdomid['t']=Array();
pdomid['availability']=Array();
pdomid['idents']=Array();
pdomid['identsn']=Array();

var flshcnt=0;

function validatebuy(f){
	if(document.getElementById("ProductIDSelect").value>0){return true;}
	else {
		flashelem();
		return false;
	}
	

}

function flashelem(color1,color2){
	if(flshcnt++>10){flshcnt=0;
		document.getElementById("ProductIDSelect").style.backgroundColor="white";
		return false;}
	if(!color1){var color1 = "red";}
	if(!color2){var color2 = "white";}
	setTimeout('document.getElementById("ProductIDSelect").style.backgroundColor="'+color1+'";flashelem("'+color2+'","'+color1+'");', 100 )
}

function ProductOptionSelect(productid){




	var error = "";
	var elem;
	var x;

	for(x in pdomid){
		if(pdomid[x][productid] != null){
			elem = document.getElementById(x);
			if(elem != null){
				elem.innerHTML=pdomid[x][productid]+" ";
			}

		}
	}
	
	elem = document.getElementById('rrpcontainer');
	if(pdomid['rprice'][productid]==pdomid['price'][productid]){
		elem.className='hide';
	} else {
		elem.className='';
	}

	
	var imagecontainer = document.getElementById('imagecontainer');
	var imagecontainerelements = imagecontainer.getElementsByTagName("div");
	var showall=(productid=="-1");

	if(imagecontainerelements!=null){
	
		for(var i = 0; i < imagecontainerelements.length; i++){
		
			imgblk = imagecontainerelements[i]
			var imgs = imgblk.getElementsByTagName("img");
			var imgas = imgblk.getElementsByTagName("a");
			imgblkpid = imgblk.id.substring(6);
			imgblkbase = imgblk.id.substring(0,6);
			
			if(imgblkbase=="imgblk"){
				if(showall){imgblk.className="showimage";} else if (imgblkpid==productid) {imgblk.className="selectimage";}
				else {imgblk.className="hideimage";}

				for(var j = 0; j < imgs.length; j++){
					var img=imgs[j];
					var imga=imgas[j];
					if ((showall && img.className=="firstofimg") || imgblk.className=="selectimage")
						{imga.rel="lightbox[product]";}
					else
						{imga.rel="lightbox[x]";}
					

				}
			}
		}
	}
	
}


