// change size of background image if user scals browserwindow
	   
	//jquery
		$(function(){
		var resizeBg = function(){ 
		
			var h = $(window).height();
			var w = $(window).width();
	
			var prop = $("#bg").width() / $("#bg").height();
			
			
			
			var headerHeight = 15;
			var footerHeight = 10;
			
			var minHeight = 415;
			var maxHeight = 500;
			
			var tempHeight = h - (headerHeight + footerHeight);
			//alert (tempHeight);
			
			
			if(w > h){
				prop = $("#bg").height() / $("#bg").width();
				$("#bg").width(w);
				$("#bg").height(w*prop);
				
			}else{
				
				$("#bg").height(h);
				$("#bg").width(h*prop);
			}
			
			
			if(tempHeight < minHeight){
				$("#homePagecontent").height(minHeight);
				//alert ("in tempHeight lest than min: " + tempHeight)
			} else if (tempHeight > maxHeight){
				$("#homePagecontent").height(maxHeight);
				//alert ("in tempHeight greater than max: " + tempHeight)
			} else if (tempHeight > minHeight && tempHeight < maxHeight) {
				$("#homePagecontent").height(tempHeight);
				//alert ("in between: " + tempHeight)
			}
	
		}
		
		resizeBg();
		
		$(window).resize(function(){resizeBg();});
			
		});
		

		
		$(document).ready(function(){
   transparentbgfunction('bg_name')
 });
		




/*This function is meant to be used when you are needing
faux getElementsByName() in IE. IE seems so use the 'id'
attribute instead of 'name' when you use getElementsByName().

tag = This tag name that the 'name' attribute you want to 
      get is attached to. Like if you called getElementsByTagName().
      
name = The value of the 'name' attribute you want.
*/
function getElementsByName_iefix(tag, name) {
	
     var elem = document.getElementsByTagName(tag);
	 var arr = new Array();
     for(i = 0, iarr = 0; i < elem.length; i++) {
          att = elem[i].getAttribute("name");
          if(att == name) {
		  	   arr[iarr] = elem[i];
			   iarr++;
          }
     }
     return arr;
}

/*This function resets the height and width of the background
to that of it's parent element's height and width.

background_id = This is the value of the name attribute you named all your
         backgrounds.
*/
function transparentbgfunction(background_id) {
	 var bodybg = getElementsByName_iefix("div", background_id);
	 for(i = 0; i < bodybg.length; i++) {
         bodybg[i].style.height = bodybg[i].parentNode.clientHeight + "px";
         bodybg[i].style.width  = bodybg[i].parentNode.clientWidth + "px";
    }
}

