var ie = 0/*@cc_on+@_jscript_version*10@*/;
		//	alert(ie);
		//alert(ie); 
			if((ie > 0)&&(ie < 57))
			{
				redirect_for_old();
			}
if (typeof(jQuery) == 'undefined')
{
	redirect_for_old();
}
else
{
	jQuery(function()
	{
		check_browser();
		jQuery.backstretch("/i/bg_gray.png");
		macStyle();
		if((jQuery('#mycarousel').length)&&(typeof jQuery('#mycarousel').jcarousel != 'undefined'))
		{
			jQuery('#mycarousel').jcarousel({
				scroll: 4
			});
		}

	});
}



function check_browser()
{
 
	warning_str = "This site is not optimized for the current version of your browser. \r\n Please, update it to the last version.";

	if(typeof jQuery=='undefined') 
		{
			redirect_for_old();
		}
	if(jQuery.browser.msie)
		{			
			
		}
		if (jQuery.browser.opera)
		{
			overs = window.opera.version();
			if(overs < 10)
			{
				redirect_for_old();
			}
		}
		if (jQuery.browser.webkit)
		{
			webkitvers = jQuery.browser.version;
			if(webkitvers[0] < 4)
			{
				redirect_for_old();
			}			
		}
		
		if (jQuery.browser.mozilla)
		{
			mozillavers = jQuery.browser.version;
			
			if(((mozillavers[2]!=0)&&(mozillavers[2]<9)))
				{
					redirect_for_old();
				}
		}

	//alert(jQuery.browser.mozilla +' ' +jQuery.browser.version);
}

function redirect_for_old()
{
	document.location.href = "/oldbrowser.html"
}

function macStyle()
{
    if (navigator.userAgent.indexOf('Mac') != -1)
    jQuery('body').addClass('mac');
}

oldtemperature = 'normal';
//Для регулятора на главной
/*function getwarm(tempval)
{
    if((tempval >=87) || (tempval < 10))
    {
        temperature = 'warm';
    }
    else if((tempval > 39) && (tempval < 60))
    {
        temperature = 'cold';
    }
    else temperature = 'normal';

    return temperature;
}*/

function getwarm(tempval)
{
    if((tempval >=17) && (tempval < 34))
    {
        temperature = 'warm';
    }
    else if((tempval > 64) && (tempval < 88))
    {
        temperature = 'cold';
    }
    else temperature = 'normal';

    return temperature;
}

/*function getwarmtop(tempval)
{
    if((tempval >=70))
    {
        temperature = 'warm';
    }
    else if((tempval <= 30))
    {
        temperature = 'cold';
    }
    else temperature = 'normal';

    return temperature;
}

function set_top_regul_by_bottom(tempval)
{
	tmp = tempval;	
	delta = 100 - tmp;
	newvalfortop = delta*2;
	newvalfortop = 100 - newvalfortop;
	if(newvalfortop < 0)
	{
		newvalfortop += 100;
		newvalfortop = 100 - newvalfortop;
	}
	
	//jQuery( "#progressbarinner" ).slider({ value: newvalfortop });
	mysl2.mySetValue(newvalfortop);
}*/

function showtemperature(tempval)
{
    temperature = getwarm(tempval);
    //jQuery('#switcherval').text(tempval);
	//set_top_regul_by_bottom(tempval);
    if(temperature != oldtemperature)
    {
        oldtemperature = temperature;
        //alert(temperature);		
        if(temperature == 'normal')
        {
            jQuery('.catalog a.normal').show();
			jQuery('#backstretch img').attr('src', '/i/bg_gray.png');
        }
        else if(temperature == 'warm')
        {
            jQuery('.catalog a.nowarm').hide();
            jQuery('.catalog a.warm').show();
			jQuery('#backstretch img').attr('src', '/i/bg_red.png');
        }
        else
        {//cold
            jQuery('a.nocold').hide();
            jQuery('a.cold').show();
			jQuery('#backstretch img').attr('src', '/i/bg_blue.png');
        }

    }
}

function showtemperaturetop(tempval)
{
    //tempval = mysl2.getValue();
	temperature = getwarmtop(tempval);
//	alert(tempval);
	
	rheostat.angle = (100 - tempval)*1.8;
	rheostat.updateIndicatorPosition2();
	//rheostat.updateIndicatorPosition();
    
    if(temperature != oldtemperature)
    {
        oldtemperature = temperature;
        //alert(temperature);
		
        if(temperature == 'normal')
        {
            jQuery('.catalog a.normal').show();
			jQuery('#backstretch img').attr('src', '/i/bg_gray.png');
        }
        else if(temperature == 'warm')
        {
            jQuery('.catalog a.nowarm').hide();
            jQuery('.catalog a.warm').show();
			jQuery('#backstretch img').attr('src', '/i/bg_red.png');
        }
        else
        {//cold
            jQuery('a.nocold').hide();
            jQuery('a.cold').show();
			jQuery('#backstretch img').attr('src', '/i/bg_blue.png');
        }

    }
}
//

//Слайд-баннеры
jQuery(function() {
    if ( jQuery('#infobanners').length )
    {
        jQuery('#infobanners').before('<div class="control" id="infobannerscontrol">').cycle({
            fx:     'fade',
            speed:  '700',
            timeout: 5000,
            pager:  '#infobannerscontrol',
            before: function() { if (window.console) console.log(this.src); }
        });
    }
});

function closeopen(itemid)
{    
    jQuery('#'+itemid).toggleClass('close');
}

function change_product_photo(url)
{
	jQuery('#ProductPhoto').attr('src', url);
}

function show_next_prod_photo()
{
	
}

function buy_filter()
{
    $city = jQuery('#city').val();
	$shop = jQuery('#shop').val();
	
    if(($city == 'all')&&($shop == 'all'))
    {
        jQuery('table.tbStore tr').show();
    }
    else if(($city == 'all')&&($shop == 'internet'))
    {
        jQuery('table.tbStore tr[city="Интернет-магазин"]').show();
        jQuery('table.tbStore tr[city!="Интернет-магазин"]').hide();
    }
	else if(($shop == 'internet')&&($city != 'all'))
	{
		jQuery('table.tbStore tr[city="'+$city+'"]').filter('[city="Интернет-магазин"]').show();
        jQuery('table.tbStore tr[city!="'+$city+'"]').hide();
		jQuery('table.tbStore tr[city!="Интернет-магазин"]').hide();
	}
	else if(($shop == 'all')&&($city != 'all'))
	{
		jQuery('table.tbStore tr[city="'+$city+'"]').show();
        jQuery('table.tbStore tr[city!="'+$city+'"]').hide();
	}
	else if(($shop != 'all')&&($city == 'all'))
	{
		jQuery('table.tbStore tr[shop="'+$shop+'"]').show();
        jQuery('table.tbStore tr[shop!="'+$shop+'"]').hide();
	}
	else
	{
		jQuery('table.tbStore tr[city="'+$city+'"]').filter('[shop="'+$shop+'"]').show();
        jQuery('table.tbStore tr[city!="'+$city+'"]').hide();
		jQuery('table.tbStore tr[shop!="'+$shop+'"]').hide();
	}
}

function category_filter()
{
    $category = jQuery('#category').val();
	
    if($category == 'all')
    {
        jQuery('div.sesrvice_b').show();
    }
    else
    {        
		jQuery('div.sesrvice_b').hide();
		jQuery('div.sesrvice_b[class~="'+$category+'"]').show();
    }
}
