var HTTP_PATH = "http://www.lifting-machine.com/";
var HTTP_CTRLPATH = "http://www.lifting-machine.com/controller/delivery/";
function fixIE6flicker(fix) {
try { document.execCommand("BackgroundImageCache", false, fix); } catch(err) { } } fixIE6flicker(true);


var jQ = jQuery.noConflict();
var catgrh = aw = 0;
		
jQuery(document).ready(function() {
	jQuery.each(jQ('#menu li'), function (i) {
		aw = aw+jQ(this).width();	
	}); 
  	aw = Math.floor((955 - aw)/(jQ('#menu li').length*2));
	aw = ((aw/955)*100)-0.1;
	jQ('#menu li').css({"padding":"0 "+aw.toFixed(1)+"%"});

	jQuery.each(jQ('div.catalog_group'), function() {
		var marg = (jQ(this).children('img').width()+20)+"px";
		jQ(this).children('h2').css({"padding-left":marg});
		jQ(this).children('ul').children('li').css({"margin-left":marg});
  		if(jQ(this).height()>=catgrh) 
		catgrh = jQ(this).height();	
		jQ(this).height(catgrh);
			  		
	});
});
function qcat(id) {
	
	if(id!=12) {
		jQ("div.wrapper").hide();
		jQ("div.next").hide();
		jQ("div.prev").hide();

		if(jQ("#load-qcat").is(":hidden")) {
			jQ("#load-qcat").show();
		}
	} else {
		
		if(jQ("div.wrapper").is(":hidden")) {
			jQ("#load-qcat").hide();
			jQ("div.next").show();
			jQ("div.prev").show();

			jQ("div.wrapper").show();
		}
	
	}

	jQ("#tab_menu li").removeClass("tab_active");
	jQ("#qcat_"+id).addClass("tab_active");

}

function calcVisitor(ad_id, url) {
	jQuery.post(HTTP_CTRLPATH+"ad/index.ctrl.php", "ctrl_action=calcVisitor&ad_id="+ad_id+"&url="+url, function(data, textStatus){
		if(textStatus == 'success'){
		  justAlertRespond(data.ActionCode, data.ErrorMsg, data.Body, data.Extra);
		} else {
			 return false;
		}
	}, "json");
	return false;
}
function justAlertRespond(ActionCode, ErrorMsg, Body, Extra){
	if(ActionCode == undefined) return false;
		if(ActionCode==5) { if(Extra) location.href=Extra; return false; }
}; 
	

