$(document).ready(function(){
	$("#searchval").focus(function() {
		if($("#searchval").val()==this.title){
		 	$("#searchval").val('');
		 }
	});
	$("#searchval").blur(function() {
		if($("#searchval").val()==''){
		 	$("#searchval").val(this.title);
		 }
	});
	
	$('#pane2').jScrollPane({showArrows:true});

	$().piroBox({
	      my_speed: 500, //animation speed
	      bg_alpha: 0.5, //background opacity
	      radius: 4, //caption rounded corner
	      pirobox_next : 'piro_next', // Nav buttons -> piro_next == inside piroBox , piro_next_out == outside piroBox
	      pirobox_prev : 'piro_prev',// Nav buttons -> piro_prev == inside piroBox , piro_prev_out == outside piroBox
	      slideShow : 'slideshow', // just delete slideshow between '' if you don't want it.
	      slideSpeed : 3 //slideshow duration in seconds(3 to 6 Recommended)
	 });
		
	if($('div.desc').height()>=$('div.maxheight').height()){
		$('div.scroll').show();
	}
	
	$("#container a.back").click(function() {
		history.back();
		return false;
	});
		
	var scroll = null;

	$('a.d_down').mousedown(function(){
		scroll = setInterval(scrollDown,10);
	});

	$('a.d_down').mouseup(function(){
		clearInterval(scroll);
	});

	$('a.d_up').mousedown(function(){
		scroll = setInterval(scrollUp,10);
	});

	$('a.d_up').mouseup(function(){
		clearInterval(scroll);
	});

	$('a.d_down').click(function(){
		return false;
	});

	$('a.d_up').click(function(){
		return false;
	});
});
	
function scrollDown(){
	if(Math.abs(parseInt($('div.desc').css('top')))<($('div.desc').height() - $('div.maxheight').height())){
		$('div.desc').css({top: (parseInt($('div.desc').css('top'))-5) + 'px'});
	}
};

function scrollUp(){
	if(parseInt($('div.desc').css('top'))<0){
		$('div.desc').css({top: (parseInt($('div.desc').css('top'))+5) + 'px'});
	}
};


