function OpenNewWindow(url, width, height) 
{ 	window.open(url, null, 'top=10,left=10,menubar=0,resizable=1,scrollbars=1,width=' + width + ',height=' + height); }

function Swap_Product_Photo(Image_Ref) {
    var Last_Product_Photo = document.getElementById('product_photo_thumbnail_2');
	var strEnd;
	strEnd = Image_Ref.src.lastIndexOf("T.");
	if (strEnd == -1) {
		strEnd = Image_Ref.src.lastIndexOf("t.");		
	}
	if (strEnd > 0) {
		document.getElementById('product_photo').src = Image_Ref.src.substring(0,strEnd) + Image_Ref.src.substring(strEnd+1,Image_Ref.src.length);
	}
	if (Last_Product_Photo) {
		Last_Product_Photo.style['borderColor'] = 'transparent';
	}
	Image_Ref.style['borderColor'] = '#FF0000';
	Last_Product_Photo = Image_Ref;
	scrollTo(0,0);
}

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

var photo_number = gup('photo');
var photo_param = 'product_photo_thumbnail_' + photo_number;
var start_photo = document.getElementById(photo_param);
Swap_Product_Photo(start_photo);

