function servisgetir(id)
{		
	$('.servisg').addClass('dpn');
	$('#c'+id).removeClass('dpn');
	$('.servisg input:checkbox').attr('checked',"");
	
	if ((id == '2') || (id == '4') || (id == '6')) 
	{ 
		$('#customer_cat').show(); 
	} 
	else 
	{ 
		$('#customer_cat input:checkbox').attr('checked',""); $('#customer_cat').hide(); 
	}
}

function servisgetir2(id,section,sgi)
{		
	$('.servisg').addClass('dpn');
	$('#c'+id).removeClass('dpn');
	$('.servisg input:checkbox').attr('checked',"");
	$('#tipx').html('Type of '+section+ ' *');
	$('#sgi').val(sgi);
	
	if ((id == '2') || (id == '4') || (id == '6')) 
	{ 
		$('#customer_cat').show(); 
	} 
	else 
	{ 
		$('#customer_cat input:checkbox').attr('checked',""); $('#customer_cat').hide(); 
	}
}

function sub3page(){
	
	if($('.servisg input:checkbox[checked=true]').length == 0)
	{
		alert('Please fill in all required items correctly');
		return false;
	}
	
	if (($('#sgi').val() == '1' || $('#sgi').val() == '3' || $('#sgi').val() == '5') && $('#customer_cat input:checkbox[checked=true]').length == 0)
	{
		alert('Please fill in all required items correctly');
		return false;
	}
}


/**
 * jQuery.timers - Timer abstractions for jQuery
 * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
 * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
 * Date: 2009/02/08
 *
 * @author Blair Mitchelmore
 * @version 1.1.2
 *
 **/

jQuery.fn.extend({
	everyTime: function(interval, label, fn, times, belay) {
		return this.each(function() {
			jQuery.timer.add(this, interval, label, fn, times, belay);
		});
	},
	oneTime: function(interval, label, fn) {
		return this.each(function() {
			jQuery.timer.add(this, interval, label, fn, 1);
		});
	},
	stopTime: function(label, fn) {
		return this.each(function() {
			jQuery.timer.remove(this, label, fn);
		});
	}
});

jQuery.event.special

jQuery.extend({
	timer: {
		global: [],
		guid: 1,
		dataKey: "jQuery.timer",
		regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
		powers: {
			// Yeah this is major overkill...
			'ms': 1,
			'cs': 10,
			'ds': 100,
			's': 1000,
			'das': 10000,
			'hs': 100000,
			'ks': 1000000
		},
		timeParse: function(value) {
			if (value == undefined || value == null)
				return null;
			var result = this.regex.exec(jQuery.trim(value.toString()));
			if (result[2]) {
				var num = parseFloat(result[1]);
				var mult = this.powers[result[2]] || 1;
				return num * mult;
			} else {
				return value;
			}
		},
		add: function(element, interval, label, fn, times, belay) {
			var counter = 0;
			
			if (jQuery.isFunction(label)) {
				if (!times) 
					times = fn;
				fn = label;
				label = interval;
			}
			
			interval = jQuery.timer.timeParse(interval);

			if (typeof interval != 'number' || isNaN(interval) || interval <= 0)
				return;

			if (times && times.constructor != Number) {
				belay = !!times;
				times = 0;
			}
			
			times = times || 0;
			belay = belay || false;
			
			var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {});
			
			if (!timers[label])
				timers[label] = {};
			
			fn.timerID = fn.timerID || this.guid++;
			
			var handler = function() {
				if (belay && this.inProgress) 
					return;
				this.inProgress = true;
				if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
					jQuery.timer.remove(element, label, fn);
				this.inProgress = false;
			};
			
			handler.timerID = fn.timerID;
			
			if (!timers[label][fn.timerID])
				timers[label][fn.timerID] = window.setInterval(handler,interval);
			
			this.global.push( element );
			
		},
		remove: function(element, label, fn) {
			var timers = jQuery.data(element, this.dataKey), ret;
			
			if ( timers ) {
				
				if (!label) {
					for ( label in timers )
						this.remove(element, label, fn);
				} else if ( timers[label] ) {
					if ( fn ) {
						if ( fn.timerID ) {
							window.clearInterval(timers[label][fn.timerID]);
							delete timers[label][fn.timerID];
						}
					} else {
						for ( var fn in timers[label] ) {
							window.clearInterval(timers[label][fn]);
							delete timers[label][fn];
						}
					}
					
					for ( ret in timers[label] ) break;
					if ( !ret ) {
						ret = null;
						delete timers[label];
					}
				}
				
				for ( ret in timers ) break;
				if ( !ret ) 
					jQuery.removeData(element, this.dataKey);
			}
		}
	}
});

jQuery(window).bind("unload", function() {
	jQuery.each(jQuery.timer.global, function(index, item) {
		jQuery.timer.remove(item);
	});
});
var sayi;
function tabDegis(){
	var kac = $('.ordertab').length;
	if(kac>0){
		if(sayi<=kac){
			$(document).stopTime("hide");
			var d = $('#orderCont .order');
			$('#orderCont .order').removeClass('curr');
			$(d[sayi]).addClass('curr');
			$('.ordertab').addClass('dpn');
			$('#'+d[sayi].id+'-t').removeClass('dpn');
		}
	}
}
function tabCalis(){
	var kere = ($('.ordertab').length);
	$(document).everyTime(5000, function(i) {
		sayi=i-1;
		tabDegis((sayi-1));
		if(sayi==kere-1){
			sayi=0;
			tabCalis();
		}
	}, kere);
}
function cvv(carousel) {
    jQuery('#vitrSol').bind('click', function() {
        carousel.next();
        return false;
    });
    jQuery('#vitrSag').bind('click', function() {
        carousel.prev();
        return false;
    });
};

$(document).ready(function(){
	
	$('#compcont .comptabtitle').click(function(){
		$('#compcont .comptabtitle').removeClass('head_blue2');
		$(this).addClass('head_blue2');
		$('.comptab').addClass('dpn');
		$('#'+this.id+'-t').removeClass('dpn');
	});
	
	if ($('#karoselsistem li').length)
	{
		jQuery('#karoselsistem').jcarousel({
				auto: 3,
				wrap: 'last',
				scroll: 1,
				initCallback: cvv
			});		
	}
	
	$('#orderCont .order').hover(
		function(){
			$(document).stopTime();
			var d = $('#orderCont .order');
			$('#orderCont .order').removeClass('curr');
			$(this).addClass('curr');
			$('.ordertab').addClass('dpn');
			$('#'+this.id+'-t').removeClass('dpn');
		},
		function(){
			tabCalis();
		}
	)
	tabCalis();
});

function favekle(title, url)
{
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}
