
function showDilly(id){
	$.post("ajax/dilly.php",{dilly_id: id},showDillyCallback);
}



function showDillyCallback(data, textStatus, http_request){
	if ( http_request.readyState == 4 ){
		if (http_request.status == 200){
			data = data.split("%|%");
			if(data.length<4) return;
			$('#remark_less').hide();
			$('#remark-content-more').hide();
			$('#remark-content').show();
			$('#remark-content').html(data[0]);
			$('#remark-tag').html(data[1]);
			$('#header-wrapper').css('background-image','url(custom/images/headerimages/'+data[2]+'.jpg)');
			$('#nav-list').attr('class','special-nav spn-'+data[3]+' iepngfix');
			$('#nremark-button').attr('class','next-remark nr-'+data[3]);
			$('#start-logo').attr('class','logo rfl-'+data[3]+' iepngfix');
			if(data.length>4){
				$('#remark-content-more').html(data[4]);
				$('#remark_more').show();
			}else{
				$('#remark_more').hide();
			}
			
			setDillyCookie("fd_img",data[2]);
			setDillyCookie("fd_color",data[3]);
			
			Cufon.refresh('.remark');
			Cufon.refresh('.remark-more');
		}
	}
}


function showNext(showNext){
	position = (position+1)%dillyIDs.length;
	showDilly(dillyIDs[position]); 
}


function showMore(){
	if (jQuery.browser.msie){
		$('#remark_more').hide();
		$('#remark-content').hide();
		$('#remark-content-more').show();
		$('#remark_less').show();
	}else{
		$('#remark_more').slideUp(200,function(){
			$('#remark-content').slideUp(300,function(){
				
				$('#remark-content-more').slideDown(650,function (){$('#remark_less').slideDown(100);});
			});
		});
	}
}

function showLess(){
	if (jQuery.browser.msie){
		$('#remark_less').hide();
		$('#remark-content-more').hide();
		$('#remark-content').show();
		$('#remark_more').show();
	}else{
		$('#remark_less').slideUp(200,function(){
			$('#remark-content-more').slideUp(650,function(){
				$('#remark-content').slideDown(300,function (){$('#remark_more').slideDown(200);});
			});	
		});
	}
}


function setDillyCookie(cookieName,cookieValue) {
 var expire = new Date();
 expire.setTime(expire.getTime() + 3600000);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}





