
function waiting_vip(){

	alert('Vi arbejder paa denne service, kom igen senere! :-)');

}

$(document).ready(function() {
			/*
			*   Examples - images
			*/

			$("a#example1").fancybox({
				'titleShow'		: false
			});

			$("a.example2").fancybox({
				'titleShow'		: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});

			$("a#example3").fancybox({
				'titleShow'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none'
			});

			$("a#example4").fancybox();

			$("a#example5").fancybox({
				'titlePosition'	: 'inside'
			});

			$("a#example6").fancybox({
				'titlePosition'	: 'over'
			});

			$("a[rel=example_group]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});

			/*
			*   Examples - various
			*/

			$("#various1").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});

			$("#various2").fancybox();

			$(".frame").fancybox({
				'width'				: '75%',
				'height'			: '75%',
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});

			$("#various4").fancybox({
				'padding'			: 0,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
		});
		
		
		
		
		
		
$(function() {
	$(".btn_update").click(function() {
	
		var test = $("#content").val();
		var dataString = 'content='+ test;
		
		if(test=='')
		{
			alert("Skriv noget tekst");
		}
		
		if(test == 'Vil du dele en historie med dine venner?'){
		
			alert("Skriv noget tekst");
		
		}
		else
		{
			$("#flash").show();
			$("#flash").fadeIn(400).html('<img src="/images/ajax-loader.gif" align="absmiddle"> <span class="loading">Loader kommentar...</span>');
		
			$.ajax({
				type: "POST",
				url: "/index.php/test/outputajax",
				data: dataString,
				cache: false,
				success: function(html){
					$("#display").before('<div>' + html + '</div>');
					$('#content').parent().find('.counter').html('200 characters left');
					document.getElementById('content').value='';
					document.getElementById('content').focus();
					$("#flash").fadeOut(700);
				}
			});
		} return false;
	});
	
	
	
	$(".new_comment_button").click(function() {
		alert('hej');
	});
	
	
	$(".new_comment").click(function() {
	
		var id = $(this).attr('id');
		
		$(".insertcommment-"+id+"").html('<form method="post" name="form" action="/index.php/newsfeed/new_comment"><div><textarea id="comment_content" name="comment_content" cols="68" rows="5"></textarea><input type="hidden" value="'+id+'" name="hidden_id" /><br /><input type="submit" value="Opret kommentar" class="new_comment_button" /></div></form>');
	});
	
	$(".new_answer_comment").click(function() {
	
		var id = $(this).attr('id');
		
		$(".insertcommment_answer-"+id+"").html('<form method="post" name="form" action="/index.php/newsfeed/new_comment"><div><textarea id="comment_content" name="comment_content" cols="68" rows="5"></textarea><input type="hidden" value="'+id+'" name="hidden_id" /><br /><input type="submit" value="Opret" class="new_comment_button btn" /></div></form>');
	});
	
});


$(document).ready(function(){

/**
 * Character Counter for inputs and text areas
 */
$('#content').each(function(){
	// get current number of characters
	var length = 200;
	// get current number of words
	//var length = $(this).val().split(/\b[\s,\.-:;]*/).length;
	// update characters
	$(this).parent().find('.counter').html( length + ' characters left');
	// bind on key up event
	$(this).keyup(function(){
		// get new length of characters
		var new_length = $(this).val().length;
		var max_length = 200;
		// get new length of words
		//var new_length = $(this).val().split(/\b[\s,\.-:;]*/).length;
		// update
		
		var new_length = max_length-new_length;
		
		$(this).parent().find('.counter').html( new_length + ' characters left');
	});
});

});




addEvent(window, 'load', initCorners);

  function initCorners() {
    var settings = {
      tl: { radius: 20 },
      tr: { radius: 20 },
      bl: { radius: 20 },
      br: { radius: 20 },
      antiAlias: true
    }

    /*
    Usage:

    curvyCorners(settingsObj, selectorStr);
    curvyCorners(settingsObj, Obj1[, Obj2[, Obj3[, . . . [, ObjN]]]]);

    selectorStr ::= complexSelector [, complexSelector]...
    complexSelector ::= singleSelector[ singleSelector]
    singleSelector ::= idType | classType
    idType ::= #id
    classType ::= [tagName].className
    tagName ::= div|p|form|blockquote|frameset // others may work
    className : .name
    selector examples:
      #mydiv p.rounded
      #mypara
      .rounded
    */
    curvyCorners(settings, ".news");
  }
  
  $(document).ready(function(){
	$("#search_q").keyup(function() 
	{
	var searchbox = $(this).val();
	var dataString = 'search_q='+ searchbox;
	if(searchbox=='')
	{}
	else
	{
	$.ajax({
	type: "POST",
	url: "<?=site_url();?>/search/sort_by",
	data: dataString,
	cache: false,
	success: function(html)
	{
	$("#show_results").html(html).show();
	}
	});
	}return false; 
	});

	
  });
  
  $(document).ready(function(){
	$('.type_of_coupon').change(function() {
		var value = $(this).val();
		var price_value = $('#price').val();
		var muliply_price = value*price_value;
		
		var price_id = $('.type_of_coupon').attr('id');
		var muliply_id_price = price_id*price_value;
		
		if(value == 'none'){
			$(".type_choose").html(''+price_value+'');
		}
		if(value == '3'){		
			$('.odds').html('Afh&aelig;nger af om du rammer 2/3 eller 3/3');
	  		$(".type_choose").html(muliply_price);
	  		$(".price_hidden").html('<option value="'+muliply_price+'">'+muliply_price+'</option>');
	  		$(".price_raw").html('<option value="'+price_value+'">'+price_value+'</option>');
	  	}
	  	if(value == '4'){		
			$('.odds').html('Afh&aelig;nger af om du rammer 3/4 eller 3/4');
	  		$(".type_choose").html(muliply_price);
	  		$(".price_hidden").html('<option value="'+muliply_price+'">'+muliply_price+'</option>');
	  		$(".price_raw").html('<option value="'+price_value+'">'+price_value+'</option>');
	  	}
	  	if(value == '2/4'){		
			$('.odds').html('Afh&aelig;nger af om du rammer 2/4 eller 4/4');
	  		$(".type_choose").html(muliply_id_price);
	  		$(".price_hidden").html('<option value="'+muliply_id_price+'">'+muliply_id_price+'</option>');
	  		$(".price_raw").html('<option value="'+price_value+'">'+price_value+'</option>');
	  	}
	});
	
	$('#price').change(function() {
	
		var value = $('.type_of_coupon').val();
		var price_value = $('#price').val();
		var muliply_price = value*price_value;
		var price_id = $('.type_of_coupon').attr('id');
		var muliply_id_price = price_id*price_value;
		
		if(value == 'none'){
			$(".type_choose").html(''+price_value+'');
		}
		if(value == '3'){		
			$('.odds').html('Afh&aelig;nger af om du rammer 2/3 eller 3/3');
	  		$(".type_choose").html(muliply_price);
	  		$(".price_hidden").html('<option value="'+muliply_price+'">'+muliply_price+'</option>');
	  		$(".price_raw").html('<option value="'+price_value+'">'+price_value+'</option>');
	  	}
	  	if(value == '4'){		
			$('.odds').html('Afh&aelig;nger af om du rammer 3/4 eller 4/4');
	  		$(".type_choose").html(muliply_price);
	  		$(".price_hidden").html('<option value="'+muliply_price+'">'+muliply_price+'</option>');
	  		$(".price_raw").html('<option value="'+price_value+'">'+price_value+'</option>');
	  	}
	  	
	  	if(value == '2/4'){		
			$('.odds').html('Afh&aelig;nger af om du rammer 2/4 eller 4/4');
	  		$(".type_choose").html(muliply_id_price);
	  		$(".price_hidden").html('<option value="'+muliply_id_price+'">'+muliply_id_price+'</option>');
	  		$(".price_raw").html('<option value="'+price_value+'">'+price_value+'</option>');
	  	}
	});
	
  });
  
  
  
  $(document).ready(function(){
  	$('#temp_odds').load('<?php echo base_url(); ?>index.php/odds/temp_odds');
  	$('.yellow-odds-big').click(function() {
  		var id = $(this).attr('id');
  		var sign = $(this).attr('alt');
  		var dataString = 'id='+id+'&sign='+sign;
  		$.ajax({
			type: "POST",
			url: "<?=base_url();?>index.php/odds/bet/",
			data: dataString,
			cache: false,
			success: function(html){
				$('#temp_odds').load('<?php echo base_url(); ?>index.php/odds/temp_odds');
			}
		});
  		
	});
  
  });
