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");
		});
	});