function capitalize(incomingString) {
	var letter = incomingString.substr(0,1);
	var str = incomingString.toLowerCase();
	return letter.toUpperCase() + str.substr(1);
}





/* function  bottom cursors */

$("#rone").live("click", function(){ 
which = $(".selected").attr("id");
uppercasewhich = capitalize(which);

whichpic = $("#pic").css("background-image");
news = whichpic.split('/');


lol = news[7].replace('.jpg)','').split('_');

newd = parseInt(lol[1], 10);
maxi = $(".selected").attr("max");

if (newd < maxi) {


	newl = newd + 1;

	if (newl < '10') { nb = "0" + newl; }
	else { nb = newl; }



	var oImage = new Image();

	oImage.src = "images/high/" + uppercasewhich + "/" + which + "_" + nb + ".jpg";

	oImage.onload = function(){
	 kil = this.width;// width of loaded image
	 if ( kil > "300") {
	landscape("images/high/" + uppercasewhich + "/" + which + "_" + nb + ".jpg"); }
	else { high("images/high/" + uppercasewhich + "/" + which + "_" + nb + ".jpg"); } 
	}


}



});


$("#lone").live("click", function(){ 
which = $(".selected").attr("id");
uppercasewhich = capitalize(which);

whichpic = $("#pic").css("background-image");
news = whichpic.split('/');

lol = news[7].replace('.jpg)','').split('_');

newd = parseInt(lol[1], 10);


if (newd > "0") {


	newl = newd - 1;

	if (newl < '10') { nb = "0" + newl; }
	else { nb = newl; }



	var oImage = new Image();

	oImage.src = "images/high/" + uppercasewhich + "/" + which + "_" + nb + ".jpg";

	oImage.onload = function(){
	 kil = this.width;// width of loaded image
	 if ( kil > "300") {
	landscape("images/high/" + uppercasewhich + "/" + which + "_" + nb + ".jpg"); }
	else { high("images/high/" + uppercasewhich + "/" + which + "_" + nb + ".jpg"); } 
	}


}


});


/* over bottom cursors */


$(".claim").live("click", function(){ 
$(".loading").show();
$(".claim").removeClass('selected');
$( this ).addClass('selected');
which = $(".selected").attr("id");
$("#thumbs").load('aquire.php?which='  + which + '&row=1',  function() {
 $(".loading").hide();   load_while_change = $(".border").attr("id");
 landscape(load_while_change);    });

$(".rarr").attr("id", "1");
$(".larr").attr("id", "0");
$(".rarr").css({"opacity" : "1.0", "filter": "alpha(opacity = 100)"});
$(".larr").css({"opacity" : "0.3", "filter": "alpha(opacity = 30)"});
});



$(".border").live("click", function(){ 
id = this.id;
landscape(id); });

$(".borderh").live("click", function(){

id = this.id;
high(id); });







$(".larr").live("click", function(){ 
which = $(".selected").attr("id");

id = parseInt(this.id);
if(id > 0) {

if(id == 1) { $(".larr").css({"opacity" : "0.3", "filter": "alpha(opacity = 30)"}); }

 $(".rarr").css({"opacity" : "1.0", "filter": "alpha(opacity = 100)"});

    $(".loading").show();
$("#thumbs").load('aquire.php?which='  + which + '&row=' + id,  function() {
         $(".loading").hide();       });

  $(".rarr").attr("id", id);
$(".larr").attr("id", id - 1 );


} });


$(".rarr").live("click", function(){ 
number = $(".selected").attr("nb");
which = $(".selected").attr("id");
id = parseInt(this.id);

if(id > 0 && id < number) {

if(id == (number - 1)) { $(".rarr").css({"opacity" : "0.3", "filter": "alpha(opacity = 30)"}); }

$(".larr").css({"opacity" : "1.0", "filter": "alpha(opacity = 100)"});
idload = id +1
    $(".loading").show();
$("#thumbs").load('aquire.php?which='  + which + '&row=' + idload,  function() {
    $(".loading").hide();
            });
  $(".rarr").attr("id", id + 1);
$(".larr").attr("id", id );

 }});




  function landscape(purl){
      $("#ones").hide();
       $(".loading").show();
	$('#pic').hide();
	jQuery.preLoadImages(purl);
       ppurl = "'" + purl + "'";
        $("#denied").animate({"width": "500px"}, "0");
 	$("#nav").animate({"margin-left": "0px"}, "150");
         $("#picframe").animate({"margin-left": "30px"}, "150");
             $("#rightbar").hide("");
	 $("#rightbar").animate({"margin-left": "0px"}, "0" , function() {
         $("#pic").css({"background": "url(" + ppurl + ") no-repeat center bottom", "margin-top" : "37px", "width" : "500px", "height" : "357px"});
	$("#pic").show();
		   $("#rightbar").fadeIn("");
	       $(".loading").hide();
	       	    $("#ones").show();
  });



};



    function high(purl){
          $("#ones").hide();
       $(".loading").show();
	$('#pic').hide();
	jQuery.preLoadImages(purl);
    ppurl = "'" + purl + "'";

 $("#nav").animate({"margin-left": "110px"}, "150");
        $("#denied").animate({"width": "250px"}, "0");
         $("#picframe").animate({"margin-left": "30px"}, "150");
             $("#rightbar").hide("");
	 $("#rightbar").animate({"margin-left": "0px"}, "0" , function() {
         $("#pic").css({"background": "url(" + ppurl + ") no-repeat center bottom", "margin-top" : "37px", "width" : "250px", "height" : "357px"});
	$("#pic").show();
		   $("#rightbar").fadeIn("");
	   $(".loading").hide();
	        	    $("#ones").show();
  });

    


};




