﻿// JavaScript Document
//<![CDATA[
$(function(){
        $('#Menu ul li').mouseover(function(){
            $(this).children('div').css({'display':'block'});
        }).mouseout(function(){
            $(this).children('div').css({'display':'none'});
        });
});


function news(ti,ev){
	
	var dh=0;
	var w=550;
	var h=400;
	
	dh = $('body').outerHeight() > document.documentElement.clientHeight? $('body').outerHeight() : document.documentElement.clientHeight;
	$('body').append('<div id="DarkDiv"></div>');
	$('#DarkDiv').css({'width':document.documentElement.clientWidth +'px','height':dh +'px','background':'#000','opacity':'0.5','position':'absolute','top':'0','left':'0',zIndex:'10'});
	$('body').append('<div id="LoadImg"><img src="../Images/loadingAnimation.gif" /></div>');
	$('#LoadImg').css({top : document.documentElement.clientHeight/2,left : ($('body').outerWidth() - 208)/2,'position':'absolute',zIndex:'11'}).fadeIn();
	$('body').append('<div id="DialogArea"><div id="DialogAreaTitle"><span>'+ti+'</span><a href="javascript:void(0);"><img alt="" src="../Images/respite.close.gif" id="DialogClose"/></a></div><div id="DialogAreaForm"></div></div>');
	$('#DialogAreaForm').html('');	
	
	$.post(
		'NewsDetail.asp',
		{id:ev},
		function(data){
			$('#DialogAreaForm').html(data).css({'height':h+'px'});
			$('#LoadImg').fadeOut('fast',function(){
				$('#LoadImg').remove();
				$('#DialogArea').css({width:w+'px',top : 20 + $(document).scrollTop(),left : ($('body').outerWidth() - w)/2 }).fadeIn('fast');			                
				$('#DialogClose').click(function(){ $('#DialogArea').fadeOut('fast',function(){
					$('#DialogArea').remove();$('#DarkDiv').remove();});
				});
			});
		}
	);
	
	
}

function WelcomeImage(obj,i,speed){
	i = i == obj.length ? 0 : i;
	obj.eq(i).animate( 
		{opacity: 'toggle'},
		{duration:speed,complete: function(){
				$(this).delay(5000, function(){
					$(this).animate({opacity: 'toggle'},
						{duration:speed,complete:function(){WelcomeImage(obj,i+1,speed);}});                            
				});
			 }
		 });
}


function proj(ti,ev){
	
	var dh=0;
	var w=550;
	var h=400;
	
	dh = $('body').outerHeight() > document.documentElement.clientHeight? $('body').outerHeight() : document.documentElement.clientHeight;
	$('body').append('<div id="DarkDiv"></div>');
	$('#DarkDiv').css({'width':document.documentElement.clientWidth +'px','height':dh +'px','background':'#000','opacity':'0.5','position':'absolute','top':'0','left':'0',zIndex:'10'});
	$('body').append('<div id="LoadImg"><img src="../Images/loadingAnimation.gif" /></div>');
	$('#LoadImg').css({top : document.documentElement.clientHeight/2,left : ($('body').outerWidth() - 208)/2,'position':'absolute',zIndex:'11'}).fadeIn();
	$('body').append('<div id="DialogArea"><div id="DialogAreaTitle"><span>'+ti+'</span><a href="javascript:void(0);"><img alt="" src="../Images/respite.close.gif" id="DialogClose"/></a></div><div id="DialogAreaForm"></div></div>');
	$('#DialogAreaForm').html('');	
	
	$.post(
		'ProjDetail.asp',
		{id:ev},
		function(data){
			$('#DialogAreaForm').html(data).css({'height':h+'px'});
			$('#LoadImg').fadeOut('fast',function(){
				$('#LoadImg').remove();
				$('#DialogArea').css({width:w+'px',top : 20 + $(document).scrollTop(),left : ($('body').outerWidth() - w)/2 }).fadeIn('fast');			                
				$('#DialogClose').click(function(){ $('#DialogArea').fadeOut('fast',function(){
					$('#DialogArea').remove();$('#DarkDiv').remove();});
				});
			});
		}
	);
	
	
}
//]]>
