function cutTextFor(divId, rowCnt, width, spacerImg){
var o = document.getElementById(divId);
if(document.getElementById(divId) == null)
	return;
document.getElementById(divId).innerHTML = getShortText(o.innerHTML, width, rowCnt, o.className ,o.style.cssText, spacerImg);
}


var ajaxUrl = site.urlBase+"ajaxIndex.jsf";
function testSrcHClose(a){} function cutTextFor(divId, rowCnt, width, spacerImg){} function closeTesteo(){}
function showAddToScNotice(){};
function showDelivMethPopup(){};
function hideDelivMethPopup(){};


/* JSON functions USAGE String str=JSON.stringify(object); Object obj=JSON.parse(string)*/
if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
		gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());
/* JSON functions end */ 

lt=function(a,b) {return a<b;}
let=function(a,b) {return a<=b;}
gt=function(a,b) {return a>b;}
get=function(a,b) {return a>=b;}

// *** base functions		
jQuery.trim = function(str) {return (str == null)?null:(""+str).replace(/^\s+|\s+$/g,"");}
jQuery.isValidDate = function(y, m, d) {y=parseInt(y,10);m=parseInt(m,10);d=parseInt(d,10);return (isNaN(y)||isNaN(m)||isNaN(d)||m>12||m<1||d<1)?false:(m==2)?((y%4==0 && y%100!=0||y%400==0 )?d<30:d<29):(("|1|3|5|7|8|10|12|".indexOf("|"+m+"|") != -1)?d<32	:d<31);};
jQuery.iso1toUtf8 = function (t) {var a = t.match(/(&#[0-9]+;)?/g);	for(var i=0;i<a.length;i=i+1) {var n=a[i].match(/[0-9]+/g);	if(n==null) continue;t = t.replace("&#"+n+";", String.fromCharCode(+n));}return t;};
log = function(text){if(typeof console == 'object' ) console.log(text)};
jQuery.getJSONSync = function(parms, callback) {$.ajax({async:false, cache:false, url:site.urlBase+"ajaxIndex.jsf",	data:parms, dataType:'json', success: callback});};
jQuery.getValidAjaxHtml = function(h) {var p=h.indexOf('<!--ajaxResponseOK-->');return (p != -1)?h.substring(p+21, h.length):false;};
//*********** jQuery PLUGIN --- UTILS --- PLUGIN *********** BEGIN
(function($){
	$.fn.toggleVisibility = function(ef, s) {//ef=effect, s=speed
		var el = $(this), o = el.is(":visible"); s=(s==undefined)?0:s;		
		if(ef==undefined) if(o)el.hide();else el.show();
		else if(ef=='slide') if(o)el.slideUp(s);else el.slideDown(s);
	}
})(jQuery);

(function($){
	$.fn.checked = function(val) {
		if(typeof val == 'boolean') {$(this).each(function(){ this.checked = val;});return this;}		
		if($(this).length == 1)	return $(this)[0].checked;
		return this;
	}
})(jQuery);
//*********** jQuery PLUGIN --- UTILS --- PLUGIN *********** END

// *********** jQuery PLUGIN --- Validated FORM --- PLUGIN *********** BEGIN
(function($){
	$.fn.makeValidatedForm = function(valFct) {
		var vldTests = [["notNull", /^.+$/im],["eml",/^[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/i],["min2orVoid",/^((.{2,})|(.{0}))$/im],["min4orVoid",/^((.{4,})|(.{0}))$/im],["min2",/^(.{2,})$/im],["min4",/^(.{4,})$/im],["pswd2",/^([a-zA-Z0-9]{2,})$/i], ["pswd3",/^([a-zA-Z0-9]{3,})$/i],["pswd6",/^([a-zA-Z0-9]{6,})$/i], ["usrName",/^([a-zA-Z0-9]{2,})$/i]];
		$("a.submit", this).click(function(){$(this).parents("form").submit();return false;});
		$(this).prepend('<input type="submit" style="display:none;"/>').submit(function() {
			var v = true;
			for(var i=0; i<vldTests.length; i=i+1) {
				$(".vld_"+vldTests[i][0],$(this)).each(function(){
					var k = vldTests[i][1].test($.trim($(this).val()));//,d = $(this).next("div.form-msg")
					$(this).vldHighlight(!k); v=(v)?k:v;
				});
			}
			$("input.vld_dateOrVoid, input.vld_date",$(this)).each(function(){
				var val = $(this).val(), k = true;
				if(!(/^.{0}$/i.test(val) && !$(this).hasClass('vld_date'))) {k=false;
					if(/^[0-3]{0,1}[0-9]{1}\.[0-1]{0,1}[0-9]{1}\.[0-9]{4}$/i.test(val)) {						
						var a = $(this).val().split('.'); k = (a.length == 3 && $.isValidDate(a[2],a[1],a[0]));
				}}
				$(this).vldHighlight(!k);
				v=(v)?k:v;
			});			
			if(typeof valFct == "function") {var v1 = valFct(v);	v = (v)?v1:v;}						
			return v;
		});
	};

	$.fn.vldHighlight = function(h,elem) {
		var f=$(this), d = (elem != undefined)?$(elem):$(f).next("div.form-msg");
		if(h) { $(f).addClass("focus"); d.show();
		} else {$(f).removeClass("focus"); d.hide();}
		if($(d).length == 0 || $.trim($(d).html())=="") alert('Error: Message Empty, field name='+$(f).attr('name'));
	};
})(jQuery);
// *********** jQuery PLUGIN --- Validated FORM --- PLUGIN *********** END

// *********** jQuery PLUGIN --- ToolTip --- PLUGIN *********** BEGIN
(function($){
	// ** ToolTip **
	$.fn.ToolTip = function(params) {
		$(this).each(function(){
			$(this).attr('tooltip', $(this).attr('title')).removeAttr('title');
			$(this).mousemove(function(){
				if(!$(this).hasToolTip()) $(this).showToolTip({html:$(this).attr('tooltip')});
				var tc = $("#"+$(this).attr('ttID'));
				clearTimeout(tc.attr("tt_to"));
				$(tc).attr("tt_to", setTimeout(function() {tc.hideToolTip()}, 5000));
			});

			$(this).mouseout(function(){
				$(this).hideToolTip();
			});
			return this;
		});
	}
	// ** MessageToolTip ** params: html, fadeInSpeed, fadeInTo, fadeOutSpeed, timeout
	$.fn.MessageToolTip = function(params) {
		var el = $(this).eq(0),
		defaultParams = {fadeInSpeed:300,fadeInTo:1,fadeOutSpeed:500, timeout:5000},p= $.extend(defaultParams, params);
		$(this).showToolTip(p);
		var tc = $(this).getAttachedToolTip();
		tc.mousemove(function(){clearTimeout(tc.attr("tt_to"));});
		tc.mouseout(function(){$(this).hideToolTip(p);});
		tc.attr("tt_to", setTimeout(function() {tc.hideToolTip(p)}, p.timeout));
		return this;
	}
	// * showToolTip *
	$.fn.showToolTip = function(params) {
		var el = $(this).eq(0),
		defaultParams = {id:"tt_"+Math.floor(Math.random()*1000), html:"no content",w:200,h:'',	fadeInSpeed:300,fadeInTo:1}, p= $.extend(defaultParams, params);
		if(el.attr('ttID') != undefined) $("#"+el.attr('ttID')).parent().remove();
		var elp=el.position(),
		tc = $('<div class="ttc" id="'+p.id+'">'+p.html+'</div>').css({opacity: 0, height:p.h, width:p.w});
		$(this).before($('<div class="ttip"></div>').append(tc));
		var w=tc.width(), h=tc.height(), elh=el.height(), elw=el.width(), r = Math.floor((w/2)-(elw/2));
		r = (r>elp.left)?elp.left-10:r;
		r = (elp.left-r+w > $(window).width())?elp.left - $(window).width() + w +20:r;
		tc.css({"left":-r, "top": ((elp.top-$(window).scrollTop()-h > 0)?-h-10:elh+5) });
		tc.fadeTo(p.fadeInSpeed, p.fadeInTo); el.attr('ttID', p.id);
	};
	// * hideToolTip *
	$.fn.hideToolTip = function(params) {
		var el = $(this).eq(0),
		defaultParams = {fadeOutSpeed:200},  p= $.extend(defaultParams, params);
		if(el.hasClass("ttc")) {tc = el; el = $("[ttID='"+el.attr('id')+"']");} else tc = $("#"+el.attr('ttID'));
		tc.fadeTo(p.fadeOutSpeed, 0, function(){tc.parent().remove(); el.removeAttr('ttID');});
	};
	// * hasToolTip *
	$.fn.hasToolTip = function(params) {return $(this).attr('ttID') != undefined;};
	// * getAttachedToolTip *
	$.fn.getAttachedToolTip = function() {return $("#"+$(this).attr('ttID'));};
})(jQuery);
$(document).ready(function(){
	$("a.ToolTip").ToolTip({});
});
// *********** jQuery PLUGIN --- ToolTip --- PLUGIN *********** END

//*********** jQuery PLUGIN --- SmartTabs --- PLUGIN *********** BEGIN
(function($){
	$.fn.SmartTabs = function() {
		
		var defaultParams = {url:'', delay:-1, oncomplete:undefined,forceOnClick:false};
		showLoadIco=function(c) {$("span.loading",c).remove();c.prepend('<span class="loading"></span>');}
		ajaxLoad=function(c) {var pUrl=c.attr('url');	
			if(pUrl) $.get(pUrl, function(data){c.empty();c.html(data);c.trigger('oncomplete'); c.attr("loaded", 1);});}		
		$(this).each(function(){
			var el = this; 
			//alert("x:"+$('.tabs',this).length);
			$('table.tabs a',this).each(function(){if($("#"+$(this).attr('rel')).length==0)$(this).removeAttr('rel');})
			$('.content',this).each(function(){				
				var p = $('.ajax',this).val();
				//alert(p);				
				if(p) {try{p = eval("("+p+")");} catch(err){p={};alert(err);} p = $.extend(defaultParams, p);	
					if(typeof p.oncomplete == 'function') $(this).bind("oncomplete", p.oncomplete); 
					p.oncomplete = undefined; $(this).attr("ajtype", (p.delay==-1)?1:2).attr(p);									
				} else $(this).attr("ajtype", 0);
			});			
			$('.content[ajtype=2]', this).each(function(){
					var c= $(this);showLoadIco(c);	
					c.attr('to',setTimeout(function(){ajaxLoad(c);
						},c.attr('delay')));
					
				});			
			$('.tabs a[rel]',this).click(function(){		
				var c = $('#'+$(this).attr('rel'), el); $('.content', el).hide(); c.show(); $('.tabs td',el).removeClass('sel');$(this).parent().addClass('sel');												
				if(c.not('[loaded]').is('div[ajtype=2][forceOnClick=true]')){clearTimeout(c.attr('to')); ajaxLoad(c);}
				if(c.not('[loaded]').is('div[ajtype=1]')){showLoadIco(c);ajaxLoad(c);} return false;
			});					
			$('.tabs .sel a',el).click();					
			return this;
		});		
	};
})(jQuery);
$(document).ready(function(){$('div.smartTabs').SmartTabs();});
//*********** jQuery PLUGIN --- SmartTabs --- PLUGIN *********** END

//######################################## MISC FUNCTIONS ######################################################
// form validation
$(document).ready(function() {$(".validatedForm").makeValidatedForm();});
// add to SC

//sc_addProducts = function(sender, pids, qInputId, cid, support) {
//prods = [{pid:123, q:2, cid:2, sup:1, bnd:123'1,234'2}, {.....}]
sc_addProducts = function(sender, prods, qInputId) {
	
	if(qInputId != undefined){	var el = $("#"+qInputId), q=1;			
		if((el.length == 1) && (!/^[1-9]+[0-9]*$/.test(el.val()) || isNaN(q=parseInt(el.val())))) {
			alert($("#msg_shoppingCart_addQuantityError").html());
			el.val(1).select().focus();
			return false;
		} if(prods.length==1)prods[0].q=q;
	}
	$(sender).css("cursor", "wait");
	$.getJSON(ajaxUrl,  {'prods':JSON.stringify(prods),_action: "addProductsToSC", "_view":"ShoppingCartBox"},
	function(data){ reRenderShoppingCartBox(); $(sender).MessageToolTip({html:data.msg}); $(sender).css("cursor", "");});
	return false;
};
sc_removeProduct = function(sender, pid, cid, supType, randId, msg) {if(confirm($.iso1toUtf8(msg))) {$.getJSON(ajaxUrl, {_action: "deleteProductFromSC", "pid":pid, "cid":cid, "supType":supType, "randId":(randId == undefined)?0:randId}, reRenderShoppingCartBox());}	return false;};
sc_removeAll = function(sender, msg) {if(confirm($.iso1toUtf8(msg))) {$.getJSON(ajaxUrl, {_action: "clearProductsFromSC"}, reRenderShoppingCartBox());}	return false;};
reRenderShoppingCartBox = function(){
$.ajax({url: site.urlBase+"ajaxViews/ViewShoppingCartBox.jsf",  dataType:"html", success:function(data) {
	data= $.getValidAjaxHtml(data);	if(data) {var p = $("#shoppingCartBox").parent(), d = $(data);p.html(data);$("#shoppingCartBox a.ToolTip").ToolTip({});} else 	location.reload();}, 
	error:function(data) {location.reload();}});};

addToFavorites = function(sender, pid, cid, isAllowed) {	
	if(!isAllowed){alert($("#msg_favorites_userNotLogged").html());	return false;}
	var dImg= site.themeBase+'navi/icons/cartFav_disabled.gif';
	if($(sender).find("img").attr("src") == dImg) return false;
	$(sender).css("cursor", "wait");
	$.getJSON(ajaxUrl, {_action: "addProductToFav", "pid":pid, "cid":cid},	function(data){	if(data.response == "ok") {$(sender).MessageToolTip({html:data.msg}).find("img").
				attr("src",dImg);}$(sender).css("cursor","default");});	
	return false;
}
// ********************* COMPARE


doCompareBoxAction = function(sender, p_id, action) {		
	//alert("add tocompare:"+pid);	
	$(sender).css("cursor", "wait");
	$.getJSONSync({_action: action, "product_id":p_id},	
				function(data){	
					if(data.response == "ok") {
						if(data.msg)$(sender).MessageToolTip({html:data.msg});
						$(sender).css("cursor","pointer");
					}
				}
			);				
	
	reRenderCompareBox();
	return false;
};

reRenderCompareBox = function(){
		$.ajax({
			url: site.urlBase+"ajaxViews/ViewCompareBox.jsf", dataType:"html", 
			success:function(data) {
					var a = '<!--ajaxResponseOK-->',
					p=data.indexOf(a);
					if(p != -1) 						
					$("#compareBox").replaceWith(data.substring(p, data.length));
				else 
					location.reload();
				}, 
				error:function(data) {location.reload();}});};



//********************* // COMPARE
productDetailsPopup = function(pid, open) {	var	dDv = $("#divProductExtendedInfo_"+pid);	
	if($(dDv).html().length == 0 && open) {		
		c("prodName_"+pid,"pdName"); c("prodPicture_"+pid,"pdProdPicture"); c("manufPicture_"+pid,"pdManufPicture");c("mediumDescr_"+pid,"pdMediumDesc");c("prodNumbers_"+pid,"pdProductNumbers");c("prodPrice_"+pid,"pdProductPrice");
	   	$("#divProductExtendedInfo_"+pid).html($("#uniquePD").html().replace(/id=\"pd/g, "id=\"pd"+pid).replace(/id=pd/g, "id=pd"+pid));	   		
	}
	dDv.css("display",open?'':'none');	
	if(open) {var eiOt = $('#tdProductExtendedInfo_'+pid).eq(0).offsetTop, spaceLeft = $('#bottomPixel').eq(0).offsetTop - (eiOt + 340); 
		dDv.css("top", (spaceLeft < eiOt)?(spaceLeft - eiOt):0)		
	}
	function c(s, d) {$("#"+d).html($("#"+s).html());}
}

// checkbox/radio input functionalities
$(document).ready(function(){
	$("input.ck_true").checked(true);$("input.ck_false").checked(false);
	$("input.valueToAddresSubmit").click(function(){window.location = $(this).val();});
	$("input.autoPost").click(function(){$(this).parents('form').submit();});
	$("select.autoPost").change(function(){$(this).parents('form').submit();});
});

// paymend and delivrey popup
$(document).ready(function(){
	$("a.under").mouseover(function() {
		var l=$(this).hasClass('lineItem'), d   = l?$(this).parents("tr.row-product").find("div.versandship"):$(this).next("div.versandshipC").find("div.versandship");		
		d.html($('#deliveryMehodPopupContent').html());
		var h = d.height(), of= $(window).height()- ($(this).position().top - $(window).scrollTop()+h+20);
		d.css( "top",(of<0)?(l?(of+30):-(h+25)):0);		
		d.fadeIn(150);		
	});
	
	$("a.under").mouseout(function() {
		var d = $(this).hasClass('lineItem')?$(this).parents("tr.row-product-over").find("div.versandship"):$(this).next("div.versandshipC").find("div.versandship");		
		d.fadeOut(150);			
	});
});
// Check price
$(document).ready(function(){		
	$('a.check_price').click(function(){
		$('a.check_price').next('div.itpc_PC').find('div.itpc_PP').fadeOut(200);	
		var el=$(this), h=$(document).attr('itckPP');			
		if(h==""||h==undefined) {$.ajax({async:false, url: site.urlBase+"ajaxViews/IntouchPriceCheckPopup.jsf", dataType:"html",	success:function(data) {var t=$.getValidAjaxHtml(data);	if(t) h = t;}});}						
		$(document).attr('itckPP',h);		
		if(el.next('div.itpc_PC').find('div.itpc_PP').length==0) el.next('div.itpc_PC').html(h);		
		var pp = el.next('div.itpc_PC').find("div.itpc_PP"), fr=pp.find('iframe'); pp.fadeIn(200);		
		if(fr.attr('src')==undefined || fr.attr('src')=='' ) fr.attr('src', site.urlBase+'checkPrice.jsf?pid='+el.attr('rel')).load(function(){$(this).show().prev('table').hide();});
		return false;
	});
});
closeIPCPP = function(sender) {$(sender).parents("div.itpc_PP").fadeOut(200);return false;}

// search hint begin
var ajr,lshS='',lshR=true;
$(document).ready(function(){
	srcHintVisible = function(v) { if(v)$("#srcHintList").show(); else $("#srcHintList").hide(); }	 
	 $("#sb_searchKeys").keyup(function(e){
		 if(!hintEnabled) return;
		 var el = $(this), c=(e.keyCode?e.keyCode:e.which),v = $.trim($(this).val());	 
		 if(v.length < 3) { srcHintVisible(false); return;}
		 if(c==27) {srcHintVisible(false);el.removeClass("searchInputOn"); clearTimeout(el.attr('to'));ajr.abort();}
		 if("|16|17|18|33|34|35|36|37|38|39|13|27|116|45|144|".indexOf("|"+c+"|") > -1) return;		 
		 if(ajr != undefined) { el.removeClass("searchInputOn"); ajr.abort();}		 		 
		 clearTimeout(el.attr('to'));				 
		// if(v.indexOf(lshS)==0 && lshS != '' && !lshR) {srcHintVisible(false); return; }			 				 		 
		 el.attr('to',setTimeout(function(){	
			var v = $.trim($("#sb_searchKeys").val());
		//	lshS = v; 
			if(v.length < 3) { srcHintVisible(false); return;}
			el.addClass("searchInputOn");			
		 	ajr = $.ajax({type:'POST', url: site.urlBase+"ajaxViews/searchHint.jsf",
		 			data:{'q':v,  '_action':'doHintSearch', 'cat':$("#srcCatId").val()},
		 			dataType:"html",	success:function(data) {var h;	
		 			 	if(!hintEnabled) return;
		 				if((h=$.getValidAjaxHtml(data)) && $.trim($("#sb_searchKeys").val()).length >= 3) {
		 					$("#srcHintList").html(data).show().html(h); srcHintVisible(true);	lshR = true;	
		 					 $("#srcHintList td").mouseover(function(){$(this).parent().addClass('hover')})
		 					 .mouseout(function(){$(this).parent().removeClass('hover')})
		 					 .click(function(){	window.location = $(this).parent().find("input[type='hidden']").val(); });
		 				} else {srcHintVisible(false);	lshR = false;}
		 			}, complete:function(){ el.removeClass("searchInputOn");}
		 	});
		 }, 500));		
	 });
	 $("#srcHintList").click(function(e){e.stopPropagation()});
	 $(document).click(function(){srcHintVisible(false);});
});
//search hint end
// main search
var hintEnabled = true;
$(document).ready(function() {
	$('#searchForm').makeValidatedForm(function(){var q=$("#sb_searchKeys").val();if($.trim($("#sb_searchKeys").val()).length > 0) {return true;}	alert($.iso1toUtf8($('#msg_searchSection_invalidSearchMsg').val()));return false;});
	$('#searchForm').submit(function(){
		if(ajr != undefined)
			ajr.abort();
		hintEnabled = false;
	});
	});
//main search end

// *** keep session alive
$(document).ready(function(){var interval = 1000*60*4; if(site.sid) setInterval(function(){$.getJSON(site.urlBase+"ajaxIndex.jsf",{'_view':'sessionKeepAlive'},function(data){if(!data.sid || data.sid != site.sid) location.reload();});}, interval);});
//*** keep session alive end

//*** for strict address validation
useStrictAddressValidation = function(contryEl, countyEl, msgPleaseSel, countySel) {
	var cSel = countySel;
	contryEl.change(function(){var crId = $(this).val(), c=countyEl;
	log(cSel);
		if(crId!='') {if(c.val()=='0') {c.attr('selCTxt', $("option:selected",c).html());}
			c.empty().append('<option value="1">'+msgPleaseSel+'</option>')[0].disabled=false;
			$.getJSON(site.urlBase+"ajaxIndex.jsf",{'_view':'statesForAddress', 'country_id':crId},function(data){
				if(data.response=='ok') {var l=eval(data.stList), i;
				for(i=0; lt(i, l.length); i++) 
						c.append('<option value="'+l[i].code+'"'+((cSel==l[i].code)?' selected="selected" ':'')+'>'+l[i].name+'</option>');				
				}
			});
		} else c.empty().append('<option value="0">'+c.attr('selCTxt')+'</option>')[0].disabled=true;
		
	});	
};
/*
 * jQuery Cycle Lite Plugin
 * http://malsup.com/jquery/cycle/lite/
 * Copyright (c) 2008 M. Alsup
 * Version: 1.0 (06/08/2008)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires: jQuery v1.2.3 or later
 */
;(function(D){var A="Lite-1.0";D.fn.cycle=function(E){return this.each(function(){E=E||{};if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var I=D(this);var J=E.slideExpr?D(E.slideExpr,this):I.children();var G=J.get();if(G.length<2){if(window.console&&window.console.log){window.console.log("terminating; too few slides: "+G.length)}return }var H=D.extend({},D.fn.cycle.defaults,E||{},D.metadata?I.metadata():D.meta?I.data():{});H.before=H.before?[H.before]:[];H.after=H.after?[H.after]:[];H.after.unshift(function(){H.busy=0});var F=this.className;H.width=parseInt((F.match(/w:(\d+)/)||[])[1])||H.width;H.height=parseInt((F.match(/h:(\d+)/)||[])[1])||H.height;H.timeout=parseInt((F.match(/t:(\d+)/)||[])[1])||H.timeout;if(I.css("position")=="static"){I.css("position","relative")}if(H.width){I.width(H.width)}if(H.height&&H.height!="auto"){I.height(H.height)}var K=0;J.css({position:"absolute",top:0,left:0}).hide().each(function(M){D(this).css("z-index",G.length-M)});D(G[K]).css("opacity",1).show();if(D.browser.msie){G[K].style.removeAttribute("filter")}if(H.fit&&H.width){J.width(H.width)}if(H.fit&&H.height&&H.height!="auto"){J.height(H.height)}if(H.pause){I.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}D.fn.cycle.transitions.fade(I,J,H);J.each(function(){var M=D(this);this.cycleH=(H.fit&&H.height)?H.height:M.height();this.cycleW=(H.fit&&H.width)?H.width:M.width()});J.not(":eq("+K+")").css({opacity:0});if(H.cssFirst){D(J[K]).css(H.cssFirst)}if(H.timeout){if(H.speed.constructor==String){H.speed={slow:600,fast:200}[H.speed]||400}if(!H.sync){H.speed=H.speed/2}while((H.timeout-H.speed)<250){H.timeout+=H.speed}}H.speedIn=H.speed;H.speedOut=H.speed;H.slideCount=G.length;H.currSlide=K;H.nextSlide=1;var L=J[K];if(H.before.length){H.before[0].apply(L,[L,L,H,true])}if(H.after.length>1){H.after[1].apply(L,[L,L,H,true])}if(H.click&&!H.next){H.next=H.click}if(H.next){D(H.next).bind("click",function(){return C(G,H,H.rev?-1:1)})}if(H.prev){D(H.prev).bind("click",function(){return C(G,H,H.rev?1:-1)})}if(H.timeout){this.cycleTimeout=setTimeout(function(){B(G,H,0,!H.rev)},H.timeout+(H.delay||0))}})};function B(J,E,I,K){if(E.busy){return }var H=J[0].parentNode,M=J[E.currSlide],L=J[E.nextSlide];if(H.cycleTimeout===0&&!I){return }if(I||!H.cyclePause){if(E.before.length){D.each(E.before,function(N,O){O.apply(L,[M,L,E,K])})}var F=function(){if(D.browser.msie){this.style.removeAttribute("filter")}D.each(E.after,function(N,O){O.apply(L,[M,L,E,K])})};if(E.nextSlide!=E.currSlide){E.busy=1;D.fn.cycle.custom(M,L,E,F)}var G=(E.nextSlide+1)==J.length;E.nextSlide=G?0:E.nextSlide+1;E.currSlide=G?J.length-1:E.nextSlide-1}if(E.timeout){H.cycleTimeout=setTimeout(function(){B(J,E,0,!E.rev)},E.timeout)}}function C(E,F,I){var H=E[0].parentNode,G=H.cycleTimeout;if(G){clearTimeout(G);H.cycleTimeout=0}F.nextSlide=F.currSlide+I;if(F.nextSlide<0){F.nextSlide=E.length-1}else{if(F.nextSlide>=E.length){F.nextSlide=0}}B(E,F,1,I>=0);return false}D.fn.cycle.custom=function(K,H,I,E){var J=D(K),G=D(H);G.css({opacity:0});var F=function(){G.animate({opacity:1},I.speedIn,I.easeIn,E)};J.animate({opacity:0},I.speedOut,I.easeOut,function(){J.css({display:"none"});if(!I.sync){F()}});if(I.sync){F()}};D.fn.cycle.transitions={fade:function(F,G,E){G.not(":eq(0)").css("opacity",0);E.before.push(function(){D(this).show()})}};D.fn.cycle.ver=function(){return A};D.fn.cycle.defaults={timeout:4000,speed:1000,next:null,prev:null,before:null,after:null,height:"auto",sync:1,fit:0,pause:0,delay:0,slideExpr:null}})(jQuery);
$(document).ready(function() {$('.slideshow').cycle();});

openIcPrint = function(url) {window.open (url,"icPrintWin", "status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1,width=620,height=600");}