﻿jQuery.fn.ImageAutoSize = function(width,height)
{
    $(this).each(function()
    {
        var image = $(this);
		
        if(image.width()>width)
        {
            image.width(width);
            image.height(width/image.width()*image.height());
        }
        if(image.height()>height)
        {
            image.height(height);
            image.width(height/image.height()*image.width());
        }
    });
} 

function flash(url,width,height)
{
document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='"+width+"' height='"+height+"'><param name='movie' value='"+url+"' /><param name='quality' value='high' /><param name='wmode' value='transparent' /><embed src='"+url+"' quality='high' wmode='transparent' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='"+width+"' height='"+height+"'></embed></object>");	
}

function popwin(url,width,height)
{
		$("#alert").load(url);
           var winTop = $(window).scrollTop();
           var winHeight = $(window).height();
           var alertHeight = $(".alert").height();
           var top  =  winTop/2 +  winHeight/2 - alertHeight/2;
		   var left=$(window).width()/2 - width/2;
		  $(".alert").width(width);
		  $(".alert").height(height);
		  $(".alert").css("left",left);
          $(".alert").css("top",top).add(".popUp").show();
		 
}
function popclose(){
$(".popUp,.alert").hide();
$("#alert").html("");
}
	   $(window).scroll(function(){
		   var winTop = $(window).scrollTop();
		   var winHeight = $(window).height();
           var alertHeight = $(".alert").height();
           var top  =  winTop +  winHeight/2 - alertHeight/2;
		   $(".popUp").css("height", winTop+winHeight+100 );
		  // $(".alert").css("top",top);
       });

