﻿// OK PLEASE PLEASE PLEASE DO NOT UNCOMMENT THIS LINE - CAUSES ALOT OF PROBLEMS !!! (WITH ANALYTICS AND MORE ...)
//undefined="undefined";

var SiteParams = {
	UploadFolder:"/CaesarStone/CaesarWeb/Data/Uploads/",
	SiteUrl:location.href.substring(0,location.href.lastIndexOf("/"))+"/",
	ResourceFolder:"/CaesarStone/CaesarWeb/Resources/Global/Image/",
	Language:"en-US"
};


onContent(function(){
	var o = $("TopSearchStr");
	if(o) o.observe ("keydown", function(e){if (captureEnter(e))top.location.href='Search.aspx?q='+encodeURIComponent(o.value);}   );

	var b = $("TopSearchBtn");
	if(b) b.observe ("click", function(e){top.location.href='Search.aspx?q='+o.value;}   );

	if(typeof(ValidationSummaryOnSubmit)!="undefined" && ValidationSummaryOnSubmit.toString){

		// disable scroll and rename the function to avoid scope problems
		var rep = ValidationSummaryOnSubmit.toString().replace(/window.scrollTo/g,"//window.scrollTo").replace(/ValidationSummaryOnSubmit/,"ValidationSummaryOnSubmit_NEW");
		eval(rep);
		ValidationSummaryOnSubmit=ValidationSummaryOnSubmit_NEW;
		//alert(ValidationSummaryOnSubmit);

	}
});

function goToCategory(loc){
	if(loc){
		self.location = loc;
		//check if we are in product page no need to reload page (Our_collection.aspx#category=573)
		if(Products && Products.currentProductId == 0){
			self.location.reload();
		}
	}
}

//Add popup box plus to links with imagePopup
onContent(function() {
    var template = '<img style="position: absolute; left: 2px; top: 2px;" alt="show" src="Resources/Global/Image/Icons/plus.jpg" />';
    $$(".imagePopup").each(function(link) {
        new Insertion.Bottom(link, template);
    });
});
