function relocate(location) {
	window.location.href = location;
	}
			 
function resizeImage(targetHeight, image) {
		if(image.height > targetHeight) {
			image.width = Math.round((targetHeight / image.height) * image.width);
			image.height = targetHeight;
			}
	}

function forceImageReplace(element) {
	element.src = badImg.src;
}

function showMerchantInfo(merchantUrl) {
	var popup = window.open(merchantUrl,'MerchantInfo','width=445,height=550,status=off');
	popup.focus();
}

function showProductRating(ratingUrl) {
	var popup = window.open(ratingUrl,'Rating_Form','width=450,height=280,toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0');
	popup.focus();
}

function adjustPopupSize () {
	if (window.document.height) {
		popupHSize = window.document.height;
		window.resizeTo(445, popupHSize + 60);
	} 
	else if (document.all) {	
		popupHSize = window.document.body.scrollHeight;
		window.resizeTo(445, popupHSize + 50);
	}
}

var badImg = new Image();

function getElementsByClassName(class_name)
	{
	  var all_obj,ret_obj=new Array(),j=0,teststr;
	  if(document.all)all_obj=document.all;
	  else if(document.getElementsByTagName && !document.all)all_obj=document.getElementsByTagName("*");
	  for(i=0;i<all_obj.length;i++)
	  {
	    if(all_obj[i].className.indexOf(class_name)!=-1)
	    {
	      teststr=","+all_obj[i].className.split(" ").join(",")+",";
	      if(teststr.indexOf(","+class_name+",")!=-1)
	      {
	        ret_obj[j]=all_obj[i];
	        j++;
	      }
	    }
	  }
	  return ret_obj;
	}

function changeStyle(className) {
		var elements = getElementsByClassName(className);
		var countryComboObj = document.getElementById("country");
 	  var countryValue = countryComboObj.options[countryComboObj.selectedIndex].value;
 	  
 		for( i = 0; i < elements.length; i++ ) {
			if(countryValue == 'us') {
				if(elements[i].className == 'registration_pd') {
					if( elements[i].style.display == "none") {
						elements[i].style.display = "block";
					} else {
						elements[i].style.display = "none";
						document.forms["contact-form"].elements["state"].selectedIndex = 0;
					}
				}
			}
			else if	(countryValue != 'us') {
				elements[i].style.display = "none";
				document.forms["contact-form"].elements["state"].selectedIndex = 0;
			}
		}
}

function showPriceHistory(ratingUrl) {
	var popup = window.open(ratingUrl,'Price_History','width=420,height=446,toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0');
	popup.focus();
}
