
jQuery.noConflict();

jQuery(function(){
	window.onload = Shadowbox.init;
});

function Elem(sObj){
	var oElem=document.getElementById(sObj);
	if(oElem){return(oElem)}
}

	
	var Cookie = {
		set : function(sName, sValue, sPath, sExpire){
			document.cookie = sName + '=' + (window.encodeURI? encodeURI(sValue) : escape(sValue)) +
				((sExpire == null)? '' : ('; expires=' + sExpire.toGMTString())) +
				((sPath == null)? '' : ('; path=' + sPath));
		},
		get : function(sName) {
			var sSearch = sName + '=';
			if(document.cookie.length > 0) {
				var iOffset = document.cookie.indexOf(sSearch);
				if(iOffset != -1) {
					iOffset += sSearch.length;
					var iEnd = document.cookie.indexOf(';', iOffset);
					if(iEnd == -1) {
						iEnd = document.cookie.length;
					}
					return window.decodeURI?
						decodeURI(document.cookie.substring(iOffset, iEnd)) :
						unescape(document.cookie.substring(iOffset, iEnd))
						;
				}
			}
			return '';
		}
	}
	
	jQuery(function(){
		if(jQuery.browser.msie && jQuery.browser.version == 8.0){
			jQuery('div.zoom').css('padding-left','35px');
		}		
	}
)
	
//	$(function(){
//		initSifr();
//			
////		$('#email').val('e-mail');
////		var cntr = $('#email').val();
////		if(cntr=='e-mail'){
////			$('#input_botton').attr('disabled','disabled')
//		});
		
	
//		$('#q').click(function(){
//			$('#q').val('')
//		});
//		$('#q').blur(function(){
//			var cntr = $('#q').val();
//			if(cntr==''){
//				$('#q').val('e-mail')
//			}
//		});
		
	
	
	//	$.getJSON('/play_list/page.html',{},function(json){
	//		aPls = [];
	//		aPls[1] = json;
	//		oPlayer.setPlaylist(aPls[1]);
	//		oPlayer.goto(1);
	//	})
	//
//	})
	
	function on_off(){
		document.location = "http://stock-center.ru/catalog_products/women/";
	}
	
function pre_logon(oEvent){
		if((oEvent.keyCode && oEvent.keyCode==13) || (oEvent.which && oEvent.which==13)){logon()};
	}
	function open_window(aLogon){
		var offset = $(aLogon).offset();
		jQuery('#log_form').css("left", offset.left-100);
		jQuery('#log_form').css("top", offset.top+18);
		jQuery('#log_form').show();
	}
	function close_window(){
		jQuery('#error_log').html('&nbsp;');
		jQuery('#log_form').hide();
	}
	/*
	function logon(){
		var lgn=$('#login').val();
		var pwd=$('#reg_email').val();
		if($('#memory')[0].checked==true){
			var iRememberMe=1;
		}else{
			var iRememberMe=0;
		}
		var data = {
			ctrl:'auth',
			cmd:'logon',
			login:lgn,
			password:pwd,
			remember:iRememberMe
		}
		if(lgn!='' && pwd!=''){
			$('#pic_load').show()
			$.post("/ctrl.html",data,function(data){
				if(data=='ok'){
					window.location='./';
				}else{
					$('#error_log').html('Неверная пара логин / пароль');
				}
				$('#pic_load').hide()
			});
		}else{
			$('#error_log').html('Неверная пара логин / пароль');
		}
	}*/

	function sub_mail(){
		var q = jQuery('#q').val();
		jQuery.post('/subs/index.html', {q: q}, function(data){
			if(data=='ok\n'){jQuery('#sub_rez').show()}
		})
	}
	
	function initSifr(){
		sIFR.replaceElement(named({sSelector:"h1.flash", sFlashSrc:"/_swf/sifr.swf", sColor:"#D92219", sLinkColor:"#000000", sBgColor:"#FFFFFF"}));
		sIFR.replaceElement(named({sSelector:"h1.flash2", sFlashSrc:"/_swf/sifr.swf", sColor:"#999999", sLinkColor:"#000000", sBgColor:"#FFFFFF"}));
		sIFR.replaceElement(named({sSelector:"span.flash3", sFlashSrc:"/_swf/sifr.swf", sColor:"#000000", sLinkColor:"#000000", sBgColor:"#FFFFFF"}));
		sIFR.replaceElement(named({sSelector:"span.flash4", sFlashSrc:"/_swf/sifr.swf", sColor:"#999999", sLinkColor:"#000000", sBgColor:"#FFFFFF"}));
		sIFR.replaceElement(named({sSelector:"h1.flash5", sFlashSrc:"/_swf/sifr.swf", sColor:"#999999", sLinkColor:"#000000", sBgColor:"#FFFFFF"}));
	}
	function player_action(){
		
	}
	
//	 jQuery.noConflict();
//
//		function slide_scroll(){
//			var $slide = jQuery('#slideshow');
//			$slide.serialScroll({
//				prev:'#move_block a.prev',
//				next:'#move_block a.next',
//				items:'div.slide',
//				duration:300,
//				force:true,
//				axis:'x',
//				stop:true,
//				lock:false,
//				step:1,
//				cycle:false,
//				visible_image_count:1
//			});
//		};


/*Функции скрытия-появление текста в 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 CheckSubscribeForm(){
	var email=jQuery('#subscribe_email').val();
	if(email=='' || email=='e-mail'){
		alert('Введите e-mail');
		return false;
	}
//	jQuery.post('/ctrl/subscribe/index.html', {email: email}, function(data){});
}

function CancelSubscribe(opros_id){
	jQuery.post("/ctrl/cancel/index.html",{opros_id:opros_id},function(json){
		window.location=json;
	});
}

function enableText(flag){
	if(flag==1){
		jQuery('#text_answer').removeAttr('disabled');
	}
	if(flag==0){
		jQuery('#text_answer').attr('disabled','disabled');
	}
}

function testEnable(obj, question){
	var iCount = jQuery('#div_q'+question).attr('count');
//		jQuery(obj).attr('enable','1');
	var cnt=0;
	var flag=false;
	var objj = null;
//	
	jQuery('input.qradio','#div_q'+question).each(
		function(){
			if(cnt <= iCount){
				if(jQuery(this)[0].checked){
					cnt=cnt+1;
					if(cnt>=iCount){
						flag=true;
//						objj = jQuery(this)[0];
//						return false;
					}else{
						flag=false;
					}
				}
			}
		}
	)
	if(flag){
//		objj.checked=false;
		jQuery('input.qradio','#div_q'+question).each(function(){
			if(jQuery(this)[0].checked != true){
				jQuery(this)[0].disabled = 'disabled';
			}
		})
	}else{
		jQuery('input.qradio','#div_q'+question).each(function(){
			jQuery(this).removeAttr('disabled');
		})
	}
}