// JavaScript Document

//project gallery functions
 $(document).ready(function(){
    
    $(".project-pointer").mouseover(function () {
		$(this).css({cursor:'pointer'})
	});
	
    $(".project-pointer").click(function () {
		var imgname = $(this).children(".ithumb").attr("src");
		//var imgdesc =$(this).children("div").children("div").html();
		//imgname = imgname.replace("thumb_", "");
		
      $("#bigimg").fadeOut(300, function () {
        $("#bigimg").attr({src:imgname}).fadeIn(600);
		//$("#project_description").html(imgdesc);
      });
 	  
      return false;
    }); 

	  
    $(".nextprev").click(function () {
		var imgname = $("#bigimg").attr("src");
		//var imgdesc =$(this).children("div").children("div").html();
		//imgname = imgname.replace("thumb_", "");
		var imgcount = $(".ithumb").length;
		var prevnext = this.id;
		var imgpoint = 0;
		if (prevnext == 'next') {
  			imgpoint = 1;
		} else {
 			imgpoint = -1;
 		}
		var imagearr = $(".ithumb");
		for (i=0; i<=(imagearr.length-1); i++ ){
			if($(imagearr[i]).attr('src') == imgname) {
				if ((i!=(imgcount-1) && (i>-1 && imgpoint == 1) || (i>0 && imgpoint == -1) )){
					imgname = $(imagearr[i+imgpoint]).attr('src');
					 
					$("#bigimg").fadeOut(300, function () {
						$("#bigimg").attr({src:imgname}).fadeIn(600); });
						break;
				}
			}
 		}
 	  
	 });
	 
  });
