var height, width;

function maintainSize( minWidth, minHeight, div ) {
    if ( window.innerHeight ){
        height = parseInt(window.innerHeight);
        width = parseInt(window.innerWidth);			                
    }else {
        height = parseInt(document.body.offsetHeight);
        width = parseInt(document.body.offsetWidth);			                    
    }			
    height = ( height >  minHeight ) ? '100%' : minHeight + 'px';
    width = ( width >  minWidth ) ? '100%' : minWidth + 'px';
    var flash = document.getElementById( div );
    
    flash.style.height= height;
    flash.style.width = width;
}



function addOnLoadEvent(func)
{	
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
    	window.onload = func;
	} else {
		window.onload = function(){
		oldonload();
		func();
		}
	}
}




$(function()
    {
	    $('.scroll-pane').jScrollPane();
		
		
		/*
		   
	 $('mp3').flash(
        { height: 16, width: 300 },
        { version: 7 },
        function(htmlOptions) {
            $this = $(this);
			htmlOptions.src =  $this.attr('swf')
            htmlOptions.flashvars.mp3 = $this.attr('url');
            $this.before($.fn.flash.transform(htmlOptions));						
        }
    );
	 
	  $('flv').flash(
        { height: 240, width: 320 },
        { version: 7 },
        function(htmlOptions) {
            $this = $(this);
			htmlOptions.src =  $this.attr('swf');
            htmlOptions.flashvars.flv = $this.attr('url');
			htmlOptions.flashvars.autostart = $this.attr('autostart');
			
			htmlOptions.flashvars.skinpath = $this.attr('skinpath');
            $this.before($.fn.flash.transform(htmlOptions));						
        }
		
		
    );			  
	  
		
		*/
		
    });
    
    
    
       function closeOverlay(){
  /*
        $($("div#JC_overlay").attr("currentDiv")).slideUp(250, function(){
            
        });
        $("div#JC_overlay").fadeTo(200, .01, function(){
                $(this).css("display", "none");
            
        });
        */
        $("div#overlayImgDiv").fadeOut(200);
		if ($.browser.msie && jQuery.browser.version >= 7) {
          // $("select, embed, object, iframe").show();
       }
	   
	   
	
	   
	   
 }
 

 
   function openOverlay(){
   
    $("div#JC_overlay").css("opacity", .01).css("display", "block");
            $("div#JC_overlay").fadeTo(200, .75);
  
  }
 
 
    
     $(document).ready(function(){
            $("body").append('<div id="JC_overlay" class="JC_overlayBG"/>');
             $("div#JC_overlay").bind("click", closeOverlay);
            
		
		});
		
		function showImage(url){
		
		//openOverlay();
		$("img#overlayImg").attr("src", url);
		$("div#overlayImgDiv").fadeIn(200);
		
		$("div#overlayImgDiv").bind("click", closeOverlay);
		if ($.browser.msie && jQuery.browser.version >= 7) {
           //$("select, embed, object, iframe").hide();
        }
		}
		
		
var iframeLoaded = false;
		
function loadiframe(url){
	iframeLoaded = true;
    $("div#overlayiframe iframe").attr("src", url);
    $("div#overlayiframe").css("width", "600px").css("height", "400px").css("top", "145px");
    $("div#overlayiframe iframe").css("width", "600px").css("height", "400px");
}


function unloadiframe(){
	
	iframeLoaded = false;
    $("div#overlayiframe iframe").attr("src", "").css("left:", "0px");
    $("div#overlayiframe").css("width", "1px").css("height", "1px").css("top", "-1px");
    $("div#overlayiframe iframe").css("width", "1px").css("height", "1px");
}

function showiframe(){
	if(iframeLoaded){
    //$("div#overlayiframe iframe").attr("src", url);
    $("div#overlayiframe").css("width", "600px").css("height", "400px").css("top", "145px");
    $("div#overlayiframe iframe").css("width", "600px").css("height", "400px");
	}
}


function hideiframe(){
	if(iframeLoaded){
    //$("div#overlayiframe iframe").attr("src", "").css("left:", "0px");
    $("div#overlayiframe").css("width", "1px").css("height", "1px").css("top", "-1px");
    $("div#overlayiframe iframe").css("width", "1px").css("height", "1px");
	}
}