function RecentlyViewed(ProductID){
	CookieValue = getCookie('RecentlyViewed');
	if (!CookieValue){
		setCookie('RecentlyViewed',ProductID,'','/');
	}else{
		var CookieItems = CookieValue.split(',');
		docookie = 1;
		for(var i=0;i < CookieItems.length;i++){
			var c = CookieItems[i];
			if (c == ProductID) docookie = 0;
		}
		if (docookie == 1) setCookie('RecentlyViewed',ProductID + ',' + CookieValue,'','/');			
	}
}

function swapImages(x,y){
	var x = $('detailImg' + x);
	var y = $('detailImg' + y);

	$('mb1').href = y.src.replace(/(\/xs\/)/g,'/L/');

	temp = y.src.replace(/(\/xs\/)/g,'/M/');
	y.src = x.src.replace(/(\/M\/)/g,'/xs/');
	x.src = temp;
	
}

function stopPicsAt(num){
	var TotalImages = $("ImageRecordcount").value;

	for(xc=num;xc<=TotalImages;xc++) {
		de = $('photocell' + xc);
		if (de) de.innerHTML='';
	}
}

function showMe(img){ 
	window.open(img); 
}

var ajax_recentlyViewed = function (){ 
	var prodId = $('productid');
	if(prodId){
		myPath = "/sigma/ajax/recentlyviewed.xml.cfm?productid=" + prodId.value; 	
	}else{
		myPath = "/sigma/ajax/recentlyviewed.xml.cfm";
	}
	result = AJAX.LoadURL( "GET", myPath );
	var rv_div = $('recentlyviewed');
	if( rv_div ) rv_div.innerHTML = result;
};

var MB = function(){
	new MultiBox('mb', {descClassName: 'multiBoxDesc'});
};

var ajax_suggestedSelling = function (){ 
	var prodId = $('productid');
	if( prodId ){
		myPath = "/sigma/ajax/suggestedselling.xml.cfm?productid=" + prodId.value; 	
		result = AJAX.LoadURL( "GET", myPath );
		var div = $('suggestedselling');
		if( div ) div.innerHTML = result;
	}
};
