hs.graphicsDir = '/_com/highslide/graphics/';
hs.align = 'center';
hs.transitions = ['expand', 'crossfade'];
hs.outlineType = 'rounded-white';
hs.wrapperClassName = 'controls-in-heading';
hs.fadeInOut = true;

jQuery(function(){
	if(jQuery('a#ny').length>0 && !getCookie("ny")){
		hs.registerOverlay({
			html: '<div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
			position: 'top right',
			fade: 2 // fading the semi-transparent overlay looks bad in IE
		});
		setCookie("ny", "1");
		hs.expand(null, {
			src: '/_img/ny/ny.jpg',
		});
	}else{
		if (hs.addSlideshow) hs.addSlideshow({
			interval: 5000,
			repeat: false,
			useControls: true,
			fixedControls: false,
			overlayOptions: {
				opacity: 1,
				position: 'top right',
				hideOnMouseOut: false
			}
		});
	}
	
	jQuery(".jCarouselLite").jCarouselLite({
//		btnNext: ".main .next",
//		btnPrev: ".main .prev",
//		mouseWheel:true,
		speed: 500,
		auto:5000
	});
	
	jQuery("#toggle_btn").toggle(
		function () {
			jQuery('#toggle_text').show();
		},
		function () {
			jQuery('#toggle_text').hide();
		}
	);

	
	jQuery('li.menu-h-d-li').hover(
		function(){
//			var color=jQuery(this).attr('color');
//			jQuery(this).find('ul.menu-h-d-li-ul li').css('background-color',color);
//			jQuery(this).css('background-color',color);
//			jQuery(this).find('a.menu-h-d-a').css('color','#ffffff');
//			jQuery(this).find('ul.menu-h-d-li-ul').show();
			jQuery(this).addClass('hover');
		},
		function(){
//			jQuery(this).css('background','none repeat scroll 0 0 transparent');
//			jQuery(this).find('a.menu-h-d-a').css('color','#666666');
//			jQuery('ul.menu-h-d-li-ul','ul.menu-h-d').hide();
			jQuery(this).removeClass('hover');
		}
	);
	jQuery('.menu-h-d-li-ul-li').hover(
		function(){
			jQuery(this).addClass('hover');
//			var hover_color=jQuery(this).attr('hover_color');
//			jQuery(this).css('background-color',hover_color);
		},
		function(){
			jQuery(this).removeClass('hover');
//			var color=jQuery(this).attr('color');
//			jQuery(this).css('background-color',color);
		}
	)
});

/*Функции скрытия-появление тектса в input по умолчанию*/
function focusTxt(id,sTxt){
		if(jQuery('#'+id).val()== sTxt ){
			jQuery('#'+id).val('');
		}	
}

function blurTxt(id,sTxt){
		if(jQuery('#'+id).val()==''){
			jQuery('#'+id).val(sTxt+'');
		}
}

function validateForgotFormSubmit(){
	if(jQuery('#email').val() == ''){
		jQuery('#error').html('Введите Ваш e-mail');
		alert('Введите e-mail');
		return false;
	};
};

/*отправка письма с главной*/
function sub_mail(){
	var q = jQuery('#dispatch_email').val();
	jQuery.post('/ctrl/sub_mail/index.html', {dispatch_email: dispatch_email}, function(data){
	})
}

function postform_hide(){
	var b=jQuery('.forum_postform');
	b.hide();
}

/*Капча*/
function captcha(){
	var oElem=$('#captcha_img')[0];
	if(oElem){
		oElem.src='/ctrl.html?ctrl=captcha&rnd='+Math.round(10000*Math.random());
		var oElem=$('#postform_captcha');
		if(oElem){
			oElem.value='';
		}
	}
}

/* Меню */

var timeoutMouseOut;
function show(obj,id){
	clearTimeout(timeoutMouseOut);
	jQuery(obj).find('#sub_menu_'+id).hide();
	jQuery('.sub_menu').hide();
	jQuery('.subdomain_sub_menu').hide();
	jQuery('#sub_menu_'+id).show();
}
function hide(){
	timeoutMouseOut = setTimeout("jQuery('.sub_menu').hide();jQuery('.subdomain_sub_menu').hide();",100);
}

/*карты*/

function open_win ( addr, width, height, title )
 {
 r = window.open( addr, '', "width="+width+", height="+height+", location=0, menubar=0, resizable=0, scrollbars=1, status=0, titlebar=0, toolbar=0, screenX=100, left=100, screenY=30, top=60 ");
// return r;
 }
 function openPic(image, width, height) {
	 var win;
	 if( win ) {
	 	win.close();
	 }
	 win = window.open( '', 'win', 'location=0, toolbar=0, menubar=0, scrollbars=0, height='+height+', width='+width+', status=0' );
	 win.document.write( '<html><head><title>ЯузаМоторс</title></head>' );
	 win.document.write( '<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">' );
	 win.document.write( '<a href="javascript: window.close()" title="Закрыть окно"><img src="http://www.yauzamotors.ru/'+image+'" width="'+width+'" height="'+height+'" border="0" /></a>' );
	 win.document.write( '</body></html>' );
	 win.document.close();
 }
 
	
	
	function ChangeForum(obj){
		var id = jQuery(obj).attr('value');
//		var splits = id.split('_');
		jQuery('#forum_id').attr('value',id);
//		jQuery('#thread_id').attr('value',splits[1]);
	}

function checkRepair(){
	var data = {
		order_num:jQuery('#order_num').val(),
		auto_num:jQuery('#auto_num').val()
	}
	jQuery('#repair').html("<img id='wait' src='/_img/loading.gif' border='0' style='left:50%;margin-left:-16px;margin-top:-16px;position:absolute;top:50%;' />");
	jQuery.post("/repair_state.html",data,function(json){
		jQuery('#repair').html(json);
	});

};

function setCookie(name, value, expires, path, domain, secure) {
    if (!name || !value) return false;
    var str = name + '=' + encodeURIComponent(value);
     
    if (expires) str += '; expires=' + expires.toGMTString();
    if (path)    str += '; path=' + path;
    if (domain)  str += '; domain=' + domain;
    if (secure)  str += '; secure';
     
    document.cookie = str;
    return true;
}
 
function getCookie(name) {
    var pattern = "(?:; )?" + name + "=([^;]*);?";
    var regexp  = new RegExp(pattern);
     
    if (regexp.test(document.cookie))
    return decodeURIComponent(RegExp["$1"]);
     
    return false;
}
 
function deleteCookie(name, path, domain) {
    setCookie(name, null, new Date(0), path, domain);
    return true;
}
