$(document).ready(function(){ 
	if(jQuery().datepicker){
	   $(".datepick").datepicker({dateFormat: "yy-mm-dd"});
	   

	$(function() {
		var dates = $( "#from, #to" ).datepicker({
			defaultDate: "+1w",
			changeMonth: true,
			dateFormat: "yy-mm-dd",
			numberOfMonths: 2,
			onSelect: function( selectedDate ) {
				var option = this.id == "from" ? "minDate" : "maxDate",
					instance = $( this ).data( "datepicker" ),
					date = $.datepicker.parseDate(
						instance.settings.dateFormat ||
						$.datepicker._defaults.dateFormat,
						selectedDate, instance.settings );
				dates.not( this ).datepicker( "option", option, date );
			}
		});
	});

	   
	   
	}

	$(".zebra tr:nth-child(odd)").css("background","#cccccc");
	//$(".clockpick").clockpick();
	
	$('.hovertable tr').hover(function() {
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	});
	
	$(".sup").hover(function(){
		$('.sub', this).show();
	},function(){
		$('.sub', this).hide('fast');
	});
  
  $(".atc").live("click",function(){
	var price = 	$(this).attr('pprice');
//	if(!price)return false;
	//alert(price);
	var deviceid = 	$(this).attr('pdevice');
	var title = 	$(this).attr('ptitle');
	
	$("#cartsum").load("_updcrt.php",{price: price, title: title,deviceid:deviceid });
//	alert(window.location.pathname);
  });

	$("#loading").bind("ajaxSend", function(){
	   $(this).show();
	 }).bind("ajaxComplete", function(){
	   $(this).hide();
	});
  
  
  
///////////////////////////////////////////// form field default text from field title  
$(".def_text").bind("focus",function(){
	 if ($(this).val() == $(this).attr('title')){
            $(this).removeClass("defaultTextActive"); $(this).val("");
        }
}).bind("blur",function(){
	 if ($(this).val() == ""){
            $(this).addClass("defaultTextActive");
            $(this).val($(this).attr('title'));
        }
}); $(".def_text").blur();

$("form").bind("submit",function(){
	 if ($('.def_text', this).val() == $('.def_text', this).attr('title')){
            $('.def_text', this).val("");
        }
});
/////////////////////////////////////////////
  
$(".faderout").animate( { opacity:0 }, 5000 );

/////////////
$('.togling').bind("click",function(){
	var secid = $(this).attr("secid");
		if(!secid)return false;
	var et = $("#"+secid).css("display");
	if(et=='none'){
		$('#'+secid).slideDown('fast');
		$('.status', this).addClass('active');
	}else{
		$('.status', this).removeClass('active');
		$('#'+secid).slideUp('fast');
	}
}); /////////



});

  
function tabber( id, clas ){
	$('.'+clas).hide();
	$('#'+id).show();
  }
  

  function togling( id ){
    
	var et = $("#"+id).css("display");
	if(et=='none'){
		$('#'+id).slideDown('fast');
		$('#'+id+' .status').addClass('fast');
	}else{
		$('#'+id).slideUp('fast');
	}
  }
  
  function sliding( id ){
  	$('#'+id).toggle(400);
	/*var et = $("#"+id).css("display");
	if(et=='none'){$('#'+id).show('slow');
	}else{$('#'+id).hide('fast');}*/
  }
  
function dinload( id, get, post){
	
	if(id==''){return false;}
	var d = new Date();
	//
	var dcontrol = d.getHours();
	//var dcontrol = d.getMinutes();

//		$.getScript("http://localhost/server/webriye/core/js/jquery.js");
//		$.getScript("http://localhost/server/webriye/core/js/myfunc.js");
	$("#"+id).load("dinload.php"+get,{val: post, control: dcontrol });

}
	
function show_first(id){
	$("#"+id).show();
}

/////////
function winclose(id){
	$(id).parents('div.window').fadeOut();
}



function fast_load(from, to){
	$("#"+to).html('').hide();
	var tt = $('#'+from).html();
	//alert(tt);
	$("#"+to).html(tt).show();
//	$("#"+to).show();
}


