var imgCaptionClasses=new Array();
imgCaptionClasses = ["img_left_caption","img_right_caption","img_caption","img_clear_caption"];
var imgPreviewClasses=new Array();
	imgPreviewClasses  =["img_left_pw","img_right_pw","img_pw","img_clear_pw"];
	
	var pwSize=500;
			//window.onDomReady(startGallery);
	
 jQuery(document).ready(function() {
 
  		
	});
	
	//KREVER BRUK AV JQUERY!!!

/*
	 legg bilde inn i en div og legg på bildetekst fra title-tag
	 
*/
function captionImage(iObj,imgClass){
	var imgwidth = jQuery(iObj).width();
			var thetext = jQuery(iObj).attr("alt");
			jQuery(iObj).wrap("<div class='"+imgClass+"'></div>");	
			
			jQuery(iObj).parent().width(imgwidth);
			if ((thetext != null)&&(thetext != ""))
			{
				//jQuery(iObj).parent().append("<p class='framecaption'>" + thetext + "</p>");
			}	
}


	jQuery(document).ready(function(){
		
	
		
		});	
	

	
//jQuery(document).ready(function(){
function imageCaptions(imgClass){
  jQuery("img."+imgClass).each(function(i) {
    var imgwidth = jQuery(this).width();
    var imgheight = jQuery(this).height();
    var captiontext =  jQuery(this).attr('title');
    var alignment = jQuery(this).attr('align');
    jQuery(this).attr({align:""});
    jQuery(this).wrap('<div class="'+imgClass+ '"></div>');
    jQuery(this).parent().width(imgwidth);
    jQuery(this).parent().append("<p>" + captiontext + "</p>");
  });
}

function imagePreviews(imgClass,size){
  jQuery("img."+imgClass).each(function(i) {
  	
  	var imgSrc = jQuery(this).attr('src');
  	//alert(imgUrl);
  	var urlArray =  imgSrc.split('/');
 	  var imgFile = urlArray[urlArray.length-1];
 	  var fileArray = imgFile.split('.');
 	  var imgId= fileArray[0];
 	  //alert(imgFile);
 
 	var pwUrl = "/?cv=8&amp;do=display&amp;id="+imgId +"&amp;template_file=display_cluetip.html&amp;use_layout=layout_blank.html&amp;hide_xcont=1"
   jQuery(this).wrap('<a class="cluetip" href="'+pwUrl+'" rel="'+pwUrl +'"></a>');
 

    
  });
}

function isInteger (s)
   {
      var i;

      if (isEmpty(s))
      if (isInteger.arguments.length == 1) return 0;
      else return (isInteger.arguments[1] == true);

      for (i = 0; i < s.length; i++)
      {
         var c = s.charAt(i);

         if (!isDigit(c)) return false;
      }

      return true;
   }
function isEmpty(s)
   {
      return ((s == null) || (s.length == 0))
   }

   function isDigit (c)
   {
      return ((c >= "0") && (c <= "9"))
   }








var h = 0;
	
function resizeBoxes(cName){
	/*find elements first*/
	var boxes = new Array;
	
	if(typeof(cName)=="undefined"){
	  cName="box_content";
	}
	
	boxes = $("."+cName);


if (h>0){
	//already set
//	alert(h);
}else{
	
	for(i=0;i<boxes.length;i++){
	  if(cName=="box_content"){
		var myID = "boxId_" +i;
		boxes[i].id=myID;
	}
		myboxh = $(boxes[i]).height();
	//  h= $(boxes[i]).height();
	//console.warn(h + " "+ myboxh)

		if(myboxh>h){
			h=myboxh;
			;
		}		
	}
	
}	
/*var cssObj = {
        background: "#DDF"
      }*/
	//alert(h);
	
	for(j=0;j<boxes.length;j++){
	   if(cName=="box_content"){
		var myID = "boxId_" +j;
		boxes[j].id=myID;
	}
	//alert (id);
//	alert(h);
		
		$(boxes[j]).height(h);
	  //$(boxes[j]).css(cssObj);
	}

}
