function rotate()
	{
	mTop=parseInt($(".caro").css("margin-top"))-1;
	if(-mTop<=fullHeight) {} else { mTop=0; }	
	$(".caro").css("margin-top",mTop);
	}

function setCookie(name,value,minutes) {
	if (minutes) {
		var date = new Date();
		date.setTime(date.getTime()+(minutes*60*1000));
		var expires = "; expires="+date.toGMTString();
	} else expires = "";
	document.cookie = name+"="+value+expires+"; path=";
}

function readCookie(name) { 
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	if (ca.length == 0) {
		ca = document.cookie.split(';');
	}
	for (var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function showq()
	{
	$.blockUI({ message: $('#question'), css: { width: '430px', cursor:'default', top: '20%' } }); 
	$('.blockOverlay').click($.unblockUI);	
	}

function hideq()
	{
	$.unblockUI();
	}
	
function submitq()
	{
	if ($("#qemail").val()=="" || $("#qname").val()=="") {$("#qerror").slideDown(); return false;}

	emailpat = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/;
	if( !emailpat.test( $("#qemail").val() ) ) {$("#qerror2").slideDown(); return false;}
	
	postdata="name="+$("#qname").val()+"&company="+$("#qcompany").val()+"&email="+$("#qemail").val()+"&phone="+$("#qphone").val()+"&free="+$("#qfree").val();

	$.ajax({
   type: "POST",
   url: "/include/sendq.php",
   data: postdata 
 	});
	$.unblockUI();	
	}

$(document).ready(function() 
	{
	speed=40;
	fullHeight=$(".caro").height();
	if($.browser.msie) { /*speed/=2; fullHeight+=6;*/ } else { fullHeight-=1; }
	for (i=1;i<3;i++) $(".caro li:nth-child("+i+")").clone().insertAfter($(".caro li:last-child"));

	rotationTimer=setInterval("rotate()",speed);
	$(".caro").hover( function () 
		{
		clearInterval(rotationTimer);
		}, function () 
		{
		rotationTimer=setInterval("rotate()",speed);
		});		
		
		
	$("input[@type=password], input[@type=text], select").addClass("base"); 
	
	$("input[@type=password], input[@type=text]").focus(function() 
		{
		$(this).addClass("baseFocus");
		});
		
	$("input[@type=password], input[@type=text]").blur(function() 
		{
		$(this).removeClass("baseFocus");
		});	
	$("#reg_error").click(function()
		{
		$(this).slideUp("fast");
		});

	$("#register_form").click(function()
		{
		$("#reg_error").slideUp("fast");
		});
	});

// new by 7even
function showorderform(text)
	{
	$('#ofbook').val(text);
	$.blockUI({ message: $('#orderdiv'), css: { width: '455px', cursor:'default', top: '10%' } }); 
	$('.blockOverlay').click($.unblockUI);	
	}

function hideorderform()
	{
	$.unblockUI();
	}
	
function submitorderform()
	{
	$("#oferror").hide();
	$("#oferror2").hide();
	$("#oferror3").hide();
	if ($("#ofbook").val()=="" || $("#ofcount").val()=="" || $("#ofname").val()=="" || $("#ofemail").val()=="" || $("#ofcompany").val()=="" || $("#ofzip").val()=="" || $("#ofcity").val()=="" || $("#ofaddress").val()=="") {$("#oferror").slideDown(); return false;}

	emailpat = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/;
	if( !emailpat.test( $("#ofemail").val() ) ) {$("#oferror2").slideDown(); return false;}
	
	if ($('#ofnewsletter').attr('checked') && !$('#oftac').attr('checked')) {$("#oferror3").slideDown(); return false;}

	$.ajax({
   type: "POST",
   url: "/include/sendorder.php",
   data: $('#orderform').serialize()
 	});
	if($('#ofnewsletter').attr('checked')) {
		postdata='subscribe=1&mass_page_id=1323&mass_language=hu&mass_name='+$('#ofname').val()+'&mass_email='+$('#ofemail').val()+'&mass_company='+$('#ofcompany').val();
		$.ajax({
		   type: "POST",
		   url: "/hirlevel",
		   data: postdata
		});
	}
	$.unblockUI();
	}