//$(document).ready(function(){
//	swfobject.embedSWF("images/introPAVC.swf", "site", "367", "171", "9.0.0", "images/expressInstall.swf");
//});

var flashvars={};
var params={menu:false,wmode:'transparent'};

$(function(){
	$('a.iconize').each(function(){
		var link=this.href;
		var regex=/\.doc$|\.pdf$/i;
		var match=link.match(regex);
		if(match=='.doc')
			icon='icon_doc.gif';
		else if(match=='.pdf')
			icon='icon_pdf.gif';
		else
			icon='icon_exe.gif';
		$(this).prepend('<img src="images/icon/'+icon+'" style="vertical-align:middle;"> &nbsp; ');
	});

	var h=320;
	if(self.innerHeight){ // all except Explorer
		h=self.innerHeight;
	}else if(document.documentElement && document.documentElement.clientHeight){ // Explorer 6 Strict Mode
		h=document.documentElement.clientHeight;
	}else if(document.body){ // other Explorers
		h=document.body.clientHeight;
	}

	$('#lamppost').height(h-534);

	$('ul, ol').each(function(){
		if($(this).children().size()>16){
			$(this).after('<br clear="all">');
			$('li',this).css({
				'width':'40%',
				'float':'left',
				'padding-left':'25px',
				'background':'url(images/pointer.png) no-repeat',
				'list-style':'none',
				'behavior':'url(style/iepngfix.htc)'
			});

		}
	});

	$('table.sideMenu td.out').hover(function(){
		this.className='over';
	},function(){
		this.className='out';
	}).click(function(){
		window.location=$(this).children().children().attr('href');
	});
		

	lang='en';
	$('link').each(function(){
		var css=this.href;
		var match=css.match(/style\/(en|ch)\.css/i);
		if(match!=null)
			lang=match[1];
	});
	
	swfobject.embedSWF("images/"+lang+"/site.swf", "site", "367", "171", "9.0.0", "images/expressInstall.swf",flashvars,params);

	$('#searchButton').hover(function(){
		$(this).fadeTo(100,0.5);
	},function(){
		$(this).fadeTo(100,1);
	});
});


// cookie
function setCookie(name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=name+"="+escape(value)+((expiredays==null)?"":";expires="+exdate.toGMTString())+';path=/';
}

function getCookie(name){
	if(document.cookie.length>0){
		start=document.cookie.indexOf(name+"=");
		if(start!=-1){ 
			start=start+name.length+1; 
			end=document.cookie.indexOf(";",start);
			if(end==-1)
				end=document.cookie.length;
			return unescape(document.cookie.substring(start,end));
		} 
	}
	return "";
}

