function renderTravelerRows(amount)
{
	if(jQuery('#container .travelCache').length == 0) jQuery('<div />').addClass('travelCache').appendTo('#container').html(jQuery('#content table.form tr.travelers tr.travelersRow:first').clone()).hide();
		
	jQuery('#content table.form tr.travelers .travelersRow').remove();
		
	amount = parseInt(amount);
	if(!isNaN(amount) || amount == 0)
	{
		
		amount = amount - 1;
		var i = 0;
		var number = 0;
		
		while(i < amount)
		{
			number = i + 2;
			jQuery(jQuery('#container .travelCache .travelersRow').clone()).appendTo('#content table.form tr.travelers table tbody');
			jQuery('#content table.form tr.travelers tr.travelersRow:last').children('.number').html(number);
			
			jQuery('#content table.form tr.travelers tr.travelersRow:last').find('input').each(function()
			{
				jQuery(this).attr('name', jQuery(this).attr('name') + number);
			});
			
			i++;
		}
		
		jQuery('#content table.form tr.travelers').fadeIn(400);		
	} else
	{
		jQuery('#content table.form tr.travelers').hide();	
	}
}

var box;

function Vaarroute1(){ 		window.location = '1-lycische-kust-zuid/'; };
function Vaarroute2(){ 		window.location = '2-lycische-kust-zuid-noord/'; };
function Vaarroute3(){ 		window.location = '3-lycische-kust-noord/'; };
function Vaarroute4(){ 		window.location = '4-lycische-kust-noord/'; };
function Vaarroute5(){ 		window.location = '5-lycische-kust-griekse-eilanden/'; };
function Vaarroute6(){ 		window.location = '6-lycische-kust-griekse-eiland/'; };
function Vaarroute7(){ 		window.location = '7-lycische-kust-noord/'; };
function Vaarroute8(){ 		window.location = '8-lycische-kust-noord-zuid/'; };
function Vaarroute9(){	 	window.location = '9-lycische-kust-noord-zuid-noord/'; };
function Vaarroute10(){ 	window.location = '10-lycische-kust-zuid/'; };
function Vaarroute11(){ 	window.location = '11-lycische-kust-zuid/'; };
function Vaarroute12(){ 	window.location = '12-lycische-kust-zuid-noord/'; };

function Hotelplaats1(){ 		window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/symi/'; };
function Hotelplaats2(){ 		window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/rhodos/'; };
function Hotelplaats3(){ 		window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/hisaronu/'; };
function Hotelplaats4(){ 		window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/dalyan/'; };
function Hotelplaats5(){ 		window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/dalaman/'; };
function Hotelplaats6(){ 		window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/gocek/'; };
function Hotelplaats7(){ 		window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/fethiye/'; };
function Hotelplaats8(){ 		window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/gemiler/'; };
function Hotelplaats9(){	 	window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/oludeniz/'; };
function Hotelplaats10(){ 	window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/kas/'; };
function Hotelplaats11(){ 	window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/kekova/'; };
function Hotelplaats12(){ 	window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/myra/'; };
function Hotelplaats13(){ 	window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/finike/'; };
function Hotelplaats14(){ 	window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/adrasan/'; };
function Hotelplaats15(){ 	window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/olympos/'; };
function Hotelplaats16(){ 	window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/phaselis/'; };
function Hotelplaats17(){ 	window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/kemer/'; };
function Hotelplaats18(){ 	window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/simena/'; };
function Hotelplaats19(){ 	window.location = 'http://test.cruiseturkije.nl/lycische-kust/familiehotels/antalya/'; };

// jQuery document ready
jQuery(document).ready(function()
{
	 box = jQuery("div:first");
	 box.scrollTop = jQuery.cookie("scroll") || 0;
	
	$('.coordinaten').imagecoords();
	
	//create Bubble Popups for each "button" element with a loading image...
		$('.hotspot').CreateBubblePopup({
										position: 'right',
										align: 'center',
										innerHtml: '<img src="/layout/images/popup/loading.gif" style="border:0px; vertical-align:middle; margin-right:10px; display:inline;" />loading!',
										innerHtmlStyle: { color: '#000000', 'text-align':'left'	 },
										themeName: 'azure',
										themePath: '/layout/images/popup/jquerybubblepopup-theme'
								  	  });

		// add a mouseover event for the "button" element...
		$('.hotspot').mouseover(function(){
				var button = $(this);
				var nummer = $(this).attr('id');
				$.get('/layout/ajax/toonplaatsinfohtml.php?id='+nummer, function(data) {
					var seconds_to_wait = 1;
					function pause(){
						var timer = setTimeout(function(){
							seconds_to_wait--;
							if(seconds_to_wait > 0){
								pause();
							}else{
								button.SetBubblePopupInnerHtml(data, false);
							};
						},1000);
					};pause();
				}); 
		}); //end mouseover event


	$('#map .map').imagemap([
	
		{top_x: 27	,top_y: 107	,bottom_x: 57		,bottom_y:120	,tekst:'Symi'			,callback: Hotelplaats1},
		{top_x: 50	,top_y: 118	,bottom_x: 62		,bottom_y:131	,tekst:'Symi'			,callback: Hotelplaats1},	
		{top_x: 85	,top_y: 164	,bottom_x: 130	,bottom_y:177	,tekst:'Rhodos'		,callback: Hotelplaats2},
		{top_x: 113	,top_y: 155	,bottom_x: 124	,bottom_y:166	,tekst:'Rhodos'		,callback: Hotelplaats2},
		{top_x: 73	,top_y: 70	,bottom_x: 126	,bottom_y:81	,tekst:'Hisaronu'	,callback: Hotelplaats3},
		{top_x: 77	,top_y: 81	,bottom_x: 88		,bottom_y:93	,tekst:'Hisaronu'	,callback: Hotelplaats3},
		{top_x: 167	,top_y: 56	,bottom_x: 213	,bottom_y:68	,tekst:'Dalyan'		,callback: Hotelplaats4},
		{top_x: 177	,top_y: 71	,bottom_x: 189	,bottom_y:80	,tekst:'Dalyan'		,callback: Hotelplaats4},
		{top_x: 194	,top_y: 70	,bottom_x: 243	,bottom_y:80	,tekst:'Dalaman'	,callback: Hotelplaats5},
		{top_x: 191	,top_y: 80	,bottom_x: 203	,bottom_y:90	,tekst:'Dalaman'	,callback: Hotelplaats5},
		{top_x: 232	,top_y: 85	,bottom_x: 268	,bottom_y:95	,tekst:'Gocek'		,callback: Hotelplaats6},
		{top_x: 232	,top_y: 94	,bottom_x: 244	,bottom_y:104	,tekst:'Gocek'		,callback: Hotelplaats6},
		{top_x: 272	,top_y: 90	,bottom_x: 335	,bottom_y:111	,tekst:'Fethiye'	,callback: Hotelplaats7},
		{top_x: 262	,top_y: 101	,bottom_x: 274	,bottom_y:113	,tekst:'Fethiye'	,callback: Hotelplaats7},
		{top_x: 259	,top_y: 116	,bottom_x: 317	,bottom_y:130	,tekst:'Gemiler'	,callback: Hotelplaats8},		
		{top_x: 264	,top_y: 134	,bottom_x: 325	,bottom_y:155	,tekst:'Oludeniz'	,callback: Hotelplaats9},
		{top_x: 328	,top_y: 180	,bottom_x: 366	,bottom_y:209	,tekst:'Kas'			,callback: Hotelplaats10},
		{top_x: 375	,top_y: 192	,bottom_x: 417	,bottom_y:205	,tekst:'Kekova'		,callback: Hotelplaats11},
		{top_x: 390	,top_y: 206	,bottom_x: 302	,bottom_y:216	,tekst:'Kekova'		,callback: Hotelplaats11},
		{top_x: 402	,top_y: 180	,bottom_x: 433	,bottom_y:191	,tekst:'Myra'			,callback: Hotelplaats12},
		{top_x: 420	,top_y: 191	,bottom_x: 433	,bottom_y:201	,tekst:'Myra'			,callback: Hotelplaats12},
		{top_x: 429	,top_y: 166	,bottom_x: 469	,bottom_y:177	,tekst:'Finike'		,callback: Hotelplaats13},
		{top_x: 436	,top_y: 178	,bottom_x: 448	,bottom_y:188	,tekst:'Finike'		,callback: Hotelplaats13},
		{top_x: 475	,top_y: 171	,bottom_x: 521	,bottom_y:184	,tekst:'Adrasan'	,callback: Hotelplaats14},
		{top_x: 503	,top_y: 184	,bottom_x: 517	,bottom_y:195	,tekst:'Adrasan'	,callback: Hotelplaats14},
		{top_x: 470	,top_y: 148	,bottom_x: 524	,bottom_y:159	,tekst:'Olympos'	,callback: Hotelplaats15},
		{top_x: 507	,top_y: 160	,bottom_x: 519	,bottom_y:170	,tekst:'Olympos'	,callback: Hotelplaats15},
		{top_x: 481	,top_y: 126	,bottom_x: 529	,bottom_y:137	,tekst:'Phaselis'	,callback: Hotelplaats16},
		{top_x: 512	,top_y: 136	,bottom_x: 526	,bottom_y:145	,tekst:'Phaselis'	,callback: Hotelplaats16},
		{top_x: 483	,top_y: 107	,bottom_x: 522	,bottom_y:118	,tekst:'Kemer'		,callback: Hotelplaats17},
		{top_x: 517	,top_y: 113	,bottom_x: 529	,bottom_y:123	,tekst:'Kemer'		,callback: Hotelplaats17},
		{top_x: 486	,top_y: 81	,bottom_x: 550	,bottom_y:99	,tekst:'Simena'		,callback: Hotelplaats18},
		{top_x: 522	,top_y: 95	,bottom_x: 535	,bottom_y:107	,tekst:'Simena'		,callback: Hotelplaats18},
		{top_x: 495	,top_y: 39	,bottom_x: 538	,bottom_y:53	,tekst:'Antalya'	,callback: Hotelplaats19}
	]);
	
	
	$('#klikbarekaart').imagemap([
	
		{top_x: 33	,top_y: 222	,bottom_x: 50	,bottom_y:236	,tekst:'Vaarroute 1'	,callback: Vaarroute1},
		{top_x: 338	,top_y: 370	,bottom_x: 367,bottom_y:384	,tekst:'Vaarroute 1'	,callback: Vaarroute1},
		{top_x: 378	,top_y: 353	,bottom_x: 401,bottom_y:364	,tekst:'Vaarroute 1'	,callback: Vaarroute1},
		
		{top_x: 52	,top_y: 221	,bottom_x: 68	,bottom_y:236	,tekst:'Vaarroute 2'	,callback: Vaarroute2},
		{top_x: 234	,top_y: 274	,bottom_x: 313,bottom_y:369	,tekst:'Vaarroute 2'	,callback: Vaarroute2},
		{top_x: 384	,top_y: 378	,bottom_x: 409,bottom_y:390	,tekst:'Vaarroute 2'	,callback: Vaarroute2},
		
		{top_x: 3		,top_y: 22	,bottom_x: 16	,bottom_y:35	,tekst:'Vaarroute 3'	,callback: Vaarroute3},
		{top_x: 225	,top_y: 68	,bottom_x: 249,bottom_y:74	,tekst:'Vaarroute 3'	,callback: Vaarroute3},
		
		{top_x: 20	,top_y: 23	,bottom_x: 36	,bottom_y:37	,tekst:'Vaarroute 4'	,callback: Vaarroute4},
		{top_x: 161	,top_y: 46	,bottom_x: 182,bottom_y:104	,tekst:'Vaarroute 4'	,callback: Vaarroute4},
		{top_x: 184	,top_y: 109	,bottom_x: 233,bottom_y:125	,tekst:'Vaarroute 4'	,callback: Vaarroute4},
		
		{top_x: 40	,top_y: 23	,bottom_x: 53	,bottom_y:36	,tekst:'Vaarroute 5'	,callback: Vaarroute5},
		{top_x: 61	,top_y: 41	,bottom_x: 151,bottom_y:128	,tekst:'Vaarroute 5'	,callback: Vaarroute5},
		
		{top_x: 88	,top_y: 203	,bottom_x: 102,bottom_y:217	,tekst:'Vaarroute 6'	,callback: Vaarroute6},
		{top_x: 59	,top_y: 243	,bottom_x: 145,bottom_y:302	,tekst:'Vaarroute 6'	,callback: Vaarroute6},
		
		{top_x: 150	,top_y: 247	,bottom_x: 228,bottom_y:295	,tekst:'Vaarroute 7'	,callback: Vaarroute7},
		{top_x: 107	,top_y: 204	,bottom_x: 120,bottom_y:217	,tekst:'Vaarroute 7'	,callback: Vaarroute7},
		
		{top_x: 60	,top_y: 21	,bottom_x: 72	,bottom_y:37	,tekst:'Vaarroute 8'	,callback: Vaarroute8},
		{top_x: 254	,top_y: 114	,bottom_x: 311,bottom_y:160	,tekst:'Vaarroute 8'	,callback: Vaarroute8},
		{top_x: 330	,top_y: 191	,bottom_x: 413,bottom_y:200	,tekst:'Vaarroute 8'	,callback: Vaarroute8},
		{top_x: 402	,top_y: 150	,bottom_x: 418,bottom_y:195	,tekst:'Vaarroute 8'	,callback: Vaarroute8},
		
		{top_x: 80	,top_y: 20	,bottom_x: 92	,bottom_y:37	,tekst:'Vaarroute 9'	,callback: Vaarroute9},
		{top_x: 235	,top_y: 122	,bottom_x: 258,bottom_y:157	,tekst:'Vaarroute 9'	,callback: Vaarroute9},
		{top_x: 235	,top_y: 151	,bottom_x: 317,bottom_y:196	,tekst:'Vaarroute 9'	,callback: Vaarroute9},
		{top_x: 322	,top_y: 157	,bottom_x: 392,bottom_y:185	,tekst:'Vaarroute 9'	,callback: Vaarroute9},
		
		{top_x: 69	,top_y: 220	,bottom_x: 82	,bottom_y:238	,tekst:'Vaarroute 10'	,callback: Vaarroute10},
		{top_x: 340	,top_y: 393	,bottom_x: 483,bottom_y:399	,tekst:'Vaarroute 10'	,callback: Vaarroute10},
		{top_x: 445	,top_y: 325	,bottom_x: 485,bottom_y:399	,tekst:'Vaarroute 10'	,callback: Vaarroute10}
	]);
	

	$('#vaarroutes.fethiye').imagemap([
		{top_x: 3		,top_y: 22	,bottom_x: 16	,bottom_y:35	,tekst:'Vaarroute 3'	,callback: Vaarroute3},
		{top_x: 225	,top_y: 68	,bottom_x: 249,bottom_y:74	,tekst:'Vaarroute 3'	,callback: Vaarroute3},
		
		{top_x: 20	,top_y: 23	,bottom_x: 36	,bottom_y:37	,tekst:'Vaarroute 4'	,callback: Vaarroute4},
		{top_x: 161	,top_y: 46	,bottom_x: 182,bottom_y:104	,tekst:'Vaarroute 4'	,callback: Vaarroute4},
		{top_x: 184	,top_y: 109	,bottom_x: 233,bottom_y:125	,tekst:'Vaarroute 4'	,callback: Vaarroute4},
		
		{top_x: 40	,top_y: 23	,bottom_x: 53	,bottom_y:36	,tekst:'Vaarroute 5'	,callback: Vaarroute5},
		{top_x: 61	,top_y: 41	,bottom_x: 151,bottom_y:128	,tekst:'Vaarroute 5'	,callback: Vaarroute5},
		
		{top_x: 60	,top_y: 21	,bottom_x: 72	,bottom_y:37	,tekst:'Vaarroute 8'	,callback: Vaarroute8},
		{top_x: 254	,top_y: 114	,bottom_x: 311,bottom_y:160	,tekst:'Vaarroute 8'	,callback: Vaarroute8},
		{top_x: 330	,top_y: 191	,bottom_x: 413,bottom_y:200	,tekst:'Vaarroute 8'	,callback: Vaarroute8},
		{top_x: 402	,top_y: 150	,bottom_x: 418,bottom_y:195	,tekst:'Vaarroute 8'	,callback: Vaarroute8},
		
		{top_x: 80	,top_y: 20	,bottom_x: 92	,bottom_y:37	,tekst:'Vaarroute 9'	,callback: Vaarroute9},
		{top_x: 235	,top_y: 122	,bottom_x: 258,bottom_y:157	,tekst:'Vaarroute 9'	,callback: Vaarroute9},
		{top_x: 235	,top_y: 151	,bottom_x: 317,bottom_y:196	,tekst:'Vaarroute 9'	,callback: Vaarroute9},
		{top_x: 322	,top_y: 157	,bottom_x: 392,bottom_y:185	,tekst:'Vaarroute 9'	,callback: Vaarroute9}
	]);
	
	$('#vaarroutes.finike').imagemap([
		{top_x: 325	,top_y: 160	,bottom_x: 370,bottom_y:190	,tekst:'Vaarroute 1'	,callback: Vaarroute1},
		{top_x: 370	,top_y: 155	,bottom_x: 405,bottom_y:175	,tekst:'Vaarroute 1'	,callback: Vaarroute1},
		
		{top_x: 225	,top_y: 80	,bottom_x: 315,bottom_y:175	,tekst:'Vaarroute 2'	,callback: Vaarroute2},
		{top_x: 380	,top_y: 190	,bottom_x: 410,bottom_y:200	,tekst:'Vaarroute 2'	,callback: Vaarroute2},
		
		{top_x: 325	,top_y: 200	,bottom_x: 490,bottom_y:210	,tekst:'Vaarroute 10'	,callback: Vaarroute10},
		{top_x: 425	,top_y: 135	,bottom_x: 490,bottom_y:210	,tekst:'Vaarroute 10'	,callback: Vaarroute10},
	]);
	
	$('#vaarroutes.kas').imagemap([
		{top_x: 315	,top_y: 165	,bottom_x: 415,bottom_y:215	,tekst:'Vaarroute 11'	,callback: Vaarroute11}
	]);
	
	$('#vaarroutes.kemer').imagemap([
		{top_x: 220	,top_y: 75	,bottom_x: 275,bottom_y:200	,tekst:'Vaarroute 12'	,callback: Vaarroute12},
		{top_x: 230	,top_y: 160	,bottom_x: 500,bottom_y:210	,tekst:'Vaarroute 12'	,callback: Vaarroute12},
		{top_x: 450	,top_y: 80	,bottom_x: 500,bottom_y:210	,tekst:'Vaarroute 12'	,callback: Vaarroute12}
	]);
	
	$('#vaarroutes.marmaris').imagemap([
		{top_x: 60	,top_y: 50	,bottom_x: 145,bottom_y:110	,tekst:'Vaarroute 6'	,callback: Vaarroute6},
		
		{top_x: 150	,top_y: 50	,bottom_x: 250,bottom_y:110	,tekst:'Vaarroute 7'	,callback: Vaarroute7}	
	]);
	
	
	jQuery('.autosubmit').click(function() {
		this.form.submit();
	});
	
	jQuery('#container #content .middle #vaarroutes').css( 'background', "url('/layout/images/content/blue-cruise/vaarroutes/"+jQuery('#container #content .middle #vaarroutes').attr( 'class' ) +".jpg') no-repeat left top" );
	
	
	jQuery('#fileinput').filestyle({
     image: "/layout/images/kieseenbestand.jpg",
     imageheight : 37,
     imagewidth : 176,
     width : 176
 
	});
	
	jQuery('#fileinput-2').filestyle({
     image: "/layout/images/kieseenbestand.jpg",
     imageheight : 37,
     imagewidth : 176,
     width : 176
 
	});
	
	
	jQuery('ul#headerimages').innerfade({
                 speed: 950,
                 timeout: 3500,
                 type: 'sequence',
                 containerheight: '178px'
            });
	
	
	jQuery(':input').autotab_magic();

	
	jQuery("a.fancy").fancybox();
	jQuery(".fancysmal").fancybox({'frameWidth' : 450, 'frameHeight': 450, 'overlayShow': true, 'hideOnContentClick': true}); 
	jQuery("a.fancykaal").fancybox({'titlePosition' 	: 'inside'});
	jQuery(".fancyFrame").fancybox({'frameWidth' : 830, 'frameHeight': 800, 'overlayShow': true, 'hideOnContentClick': false});
	
	jQuery(".tweets").getTwitter({
					userName: "GuletTravel",
					numTweets: 3,
					loaderText: "Laden...",
					slideIn: false,
					slideDuration: 500,
					showHeading: true,
					headingText: "BlueCruise tweets",
					showProfileLink: false,
					showTimestamp: true

				});
	
	jQuery('.scrolltotop').click(function() {
	jQuery('html, body').animate({ scrollTop:0 }, 'slow');
		return false;
	});

	jQuery('.maketarget').attr({'target' : '_blank'});
	
	
	if(jQuery('#content .left .submenu').is(':visible'))
	{
		jQuery('#content .left .submenu > ul > li').each(function()
		{
			if(jQuery(this).children('ul').is(':visible')) jQuery(this).addClass('hasul');
			
			if(jQuery(this).children('ul').children('li').hasClass('selected')) jQuery(this).addClass('selectedchildren');
		});
		jQuery('#content .left .submenu > ul > li > ul > li').each(function()
		{
			if(jQuery(this).children('ul').is(':visible')) jQuery(this).addClass('hasul');
			
			if(jQuery(this).children('ul').children('li').hasClass('selected')) jQuery(this).addClass('selectedchildren');
		});
	}
	
	// Superfish menu 
	if(jQuery('#navigation .sf-menu').is(':visible'))
	{
		jQuery('#navigation .sf-menu').superfish({
			autoArrows:    false,
			dropShadows:   false
		}); 
	}
	// Data table 
	if(jQuery('#content table.data').is(':visible'))
	{
		jQuery('#content table.data tr:even').addClass('even');
	}
	if(jQuery('#content table.price').is(':visible'))
	{
		jQuery('#content .hoteldetail table tr:odd').addClass('odd');
	}
	// Travelers table
	if(jQuery('#content table.form .travelers').is(':visible'))
	{
		renderTravelerRows();
		jQuery('#content table.form #travelers').change(function()
		{
			if(jQuery(this).val() > 1)
			{
				renderTravelerRows(jQuery(this).val());
			} else
			{
				renderTravelerRows();	
			}
		});
	}
	
	// Mailingen sturen
	if(jQuery('#content table.form .mailingtype').is(':visible'))
	{
		alert('een');
		jQuery('#content table.form #typenieuwsbrief').change(function()
		{
			alert('val: ' + jQuery(this).val());
			if(jQuery(this).val() == 'normaal')
			{
				jQuery('#content table.form tr.mailingtype_normaal').fadeIn(400);	
				jQuery('#content table.form tr.mailingtype_actie').hide();
			} else
			{
				jQuery('#content table.form tr.mailingtype_actie').fadeIn(400);	
				jQuery('#content table.form tr.mailingtype_normaal').hide();	
			}
		});
	}
});

window.onbeforeunload = function () {
	jQuery.cookie("scroll", box.scrollTop, { expires: 7 });
}

/* The jQuery cookie plugin */
jQuery.cookie = function (name, value, options) {
	if (typeof value != 'undefined') { // name and value given, set cookie
		options = options || {};
		if (value === null) {
			value = '';
			options.expires = -1;
		}
		var expires = '';
		if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
			var date;
			if (typeof options.expires == 'number') {
				date = new Date();
				date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
			} else {
				date = options.expires;
			}
			expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
		}
		// CAUTION: Needed to parenthesize options.path and options.domain
		// in the following expressions, otherwise they evaluate to undefined
		// in the packed version for some reason...
		var path = options.path ? '; path=' + (options.path) : '';
		var domain = options.domain ? '; domain=' + (options.domain) : '';
		var secure = options.secure ? '; secure' : '';
		document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
		var cookieValue = null;
		if (document.cookie && document.cookie != '') {
			var cookies = document.cookie.split(';');
			for (var i = 0; i < cookies.length; i++) {
				var cookie = jQuery.trim(cookies[i]);
				// Does this cookie string begin with the name we want?
				if (cookie.substring(0, name.length + 1) == (name + '=')) {
					cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
					break;
				}
			}
		}
		return cookieValue;
	}
};

