$(document).ready(function(){
	//$('.select_bckgr').selectbox({debug: true});
	$(".imagesSlideshow").cycle({
		fx:      'fade',
		speed:   800,
		timeout: 4000
	});
	
	$('.tab').click(function(){
		var id = $(this).attr('id');		
		$('.tab').removeClass('tab-active');
		$(this).addClass('tab-active');
		$('.tab_content').hide();;
		$('#'+id+'_content').show();
	});
	
	$(".tabs .tab:first").addClass('tab-active');
	$(".tabs .tab_content").hide();
	$(".tabs .tab_content:first").show();
	
	var tabcounter = 10;
	$('.tab').each(function(){
		$(this).css('z-index',tabcounter--);
	});

});


function setCookie(c_name,value,expiredays,path,domain,secure){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	var cookie_string = c_name+ "=" +escape(value);
	cookie_string += (expiredays==null) ? "" : ";expires="+exdate.toGMTString();
	if (path) {
        cookie_string += "; path=" + escape ( path );
	}
	if ( domain ) {
        cookie_string += "; domain=" + escape ( domain );
	}
	if ( secure ) {
        cookie_string += "; secure";
	}
	document.cookie=cookie_string;
}




function get_cookie ( cookie_name ) {
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}

function showMore(selector,h){
	$('#'+selector).animate({height : h});
	$('#'+selector).parent().find('.hide').show();
	$('#'+selector).parent().find('.show').hide();
}
function showLess(selector,h){
	$('#'+selector).animate({height : h});
	$('#'+selector).parent().find('.hide').hide();
	$('#'+selector).parent().find('.show').show();
}


function sendComment (formId){
	var url = window.location;
	$.post(MAIN_URL+'modules/comments/sendComment.php?ajax&url='+url,$("#"+formId).serialize(),  
         function(data){
         	if (data == '1') {
         		window.location.reload();
         	} else {
            	$("#sendCommentContentWindow").empty().html(data); 
         	}
         } 
     );
}

function wait(){
	$("#wait").show();
	return false;
}

function closeWait(){
	$("#wait").hide();
}
