// Albinno JavaScript v1.2 - Carbon Teknoloji ~ Hazar Karabay

$(document).ready(function() {
	if ($("#header h1").length > 0) { 
		$("#header h1").click(function(event) { window.location = "index.php"; }).addClass('hand');
	}
	
	$(".altbox").equalHeights();
		
	if(jQuery().fancybox) {
		$(".fancy a, a.fancy").fancybox({
			'overlayShow'			: true,
			'zoomSpeedIn'			: 600,
			'zoomSpeedOut'			: 500,
			'centerOnScroll'		: true
		});
	}
		
	$("a[href^='http:']:not([href*='" + window.location.host + "'][target='_blank'])").live('click', function(){
		$(this).attr('target','_blank');
	});
	
	$("ul.tabs").tabs("div.panes > div");
	
	$("#urunresim img").bind("load", function () { $(this).fadeIn(); });
	
	$(".urunrenk a").click(function() {
		if (event.preventDefault) { event.preventDefault(); } else { event.returnValue = false; } // IE..
		
		var rel = $(this).attr('rel');
		var href = $(this).attr('href');
		$("#urunresim img").fadeOut(function() {
											 /*$.ajax({
													url: rel,
													complete: function(XMLHttpRequest, textStatus) {
														if (textStatus != 'error') {*/
															$("#urunresim a").attr({'href': rel});
															$("#urunresim img").attr({'src': href, 'width': 465, 'height': 356}); // Yine IE..
														/*}
													}
												});*/
											 });
		
		
				
	});
	
});

/**
 * Equal Heights Plugin
 * Copyright (c) 2008 Rob Glazebrook (cssnewbie.com) 
 */

(function($) {
	$.fn.equalHeights = function(minHeight, maxHeight) {
		tallest = (minHeight) ? minHeight : 0;
		this.each(function() {
			if($(this).height() > tallest) {
				tallest = $(this).height();
			}
		});
		if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
		return this.each(function() {
			$(this).height(tallest).css("overflow","visible"); // hack.
		});
	}
})(jQuery);

function numVld(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;	
	else return true;
}

function priceVld(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode == 44) return true;
	else {
		if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;
		else return true;
	}
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=820,height=670,left = 430,top = 195');");
}
