var jsReady=false;
$(document).ready(function(){
jsReady = true;$('#trytry').append('document ready>:');$('#trytry').css('display','none');
if(!$.browser.msie){
$('#hide1').css('opacity','.8');
$('.bpic_left,.box_top_left,.box_bottom_left').css('opacity','.5');
$('#msn').attr('href','mailto: ask@mulandesign.com');
}else{
$('#msn').attr('href','msnim:chat?contact=ask@mulandesign.com');
$('#hide1').css('filter',' Alpha(opacity=80)');
$('.bpic_left,.box_top_left,.box_bottom_left ').css('filter','Alpha(opacity=50)');
}
$('#hide1').click(function(){
$('#bbs').animate({'width': '0px','opacity':'0','right':'0px'},800, function(){
closeDialog();
});
$('#mailmsg').animate({'width': '0px','opacity':'.3'},0,function(){
closeDialog();
});
});
$('#close').mouseover(function(){
$(this).css('background-position',' 0 0');
});
$('#close').mouseout(function(){
$(this).css('background-position','0 -25px');
});
$('#close').click(function(){
$('#bbs').animate({'width': '0px','opacity':'.3'},0,function(){
closeDialog();
});
});
$('#mailmsg-close').mouseover(function(){
$(this).css('background-position',' 0 0 ');
});
$('#mailmsg-close').mouseout(function(){
$(this).css('background-position','0 -25px');
});
$('#mailmsg-close').click(function(){
$('#mailmsg').animate({'width': '0px','opacity':'.3'},0,function(){
closeDialog();
});
});
$('#submit1').mouseover(function(){
$(this).css('background-position','0 -24px');
});
$('#submit1').mouseout(function(){
$(this).css('background-position','0 0');
});
$('#reset1').mouseover(function(){
$(this).css('background-position','0 -24px');
});
$('#reset1').mouseout(function(){
$(this).css('background-position','0 0');
});
$('#leavemsg1').click(function(){
var temp=$('#bbs').css('width');
var right=(document.documentElement.clientWidth-586)/2;
$('#bbs').css('opacity','0');
if(temp=='0px'){
showDialog();
$('#bbs').animate({'width': '586px','opacity':'.85','right':right+'px'},800);
return;
}
});
$('#chinese').mouseover(function(){
$(this).css('background-position','0 -30px');
});
$('#chinese').mouseout(function(){
$(this).css('background-position','0 0');
});
$('#english').mouseover(function(){
$(this).css('background-position','0 -16px');
});
$('#english').mouseout(function(){
$(this).css('background-position','0 0');
});
$('#contme').mouseover(function(){
$(this).css('background-position',' 0 -21px ');
});
$('#contme').mouseout(function(){
$(this).css('background-position','0  0');
});
$('#cont').mouseover(function(){
$(this).css('background-position','0 -42px');
});
$('#cont').mouseout(function(){
$(this).css('background-position','0 0');
});
$('#downloadzfb').mouseover(function(){
$(this).css('background-position','0 -21px');
});
$('#downloadzfb').mouseout(function(){
$(this).css('background-position','0 0');
});
$('#downloadff').mouseover(function(){
$(this).css('background-position','0 -21px');
});
$('#downloadff').mouseout(function(){
$(this).css('background-position','0 0');
});
if($.browser.msie && $.browser.version=='6.0'){//
$('#nav > div > ul > li > ul').each(function(){
$(this).css('text-align','left');
$(this).parent().find('a').append($(this));//.find('ul').wrap('<table><tr><td></td></tr></table>');
$(this).remove();
});
}
$('#nav > div > ul > li > a').each(function(i){
/*$(this).mouseover(function(){
$(this).find('ul').css('display','block');
});
$(this).mouseout(function(){
$(this).find('ul').css('display','none');
});*/
$(this).find('ul').css('display','none');
$(this).mouseover(function(e){
if (!e) e = window.event;
var tg = (window.event) ? e.srcElement : e.target;   
var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
while (reltg.nodeName != 'BODY'&&$(reltg).get(0)!=$(tg).parents('li:last').get(0))
reltg= reltg.parentNode;
if ($(reltg).get(0)==$(tg).parents('li:last').get(0)) return;
$(this).parent().find('ul').stop(null,true).show(300);
});
$(this).parent().mouseout(function(e){
if (!e) e = window.event;
var tg = (window.event) ? e.srcElement : e.target;   
var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
while (reltg.nodeName != 'BODY'&&$(reltg).get(0)!=$(tg).parents('li:last').get(0))
reltg= reltg.parentNode;
if ($(reltg).get(0)==$(tg).parents('li:last').get(0)) return;
$(this).find('ul').stop(null,true);
$(this).find('ul').hide(300);
});
});
$('a').each(function(){
$(this).focus(function(){
$(this).blur();
});
});
});
function picload(){
var d=document;
if(!d.MM_p) d.MM_p=new Array();
var i;
var j=d.MM_p.length;
var a=picload.arguments;
for(i=0; i<a.length; i++){
d.MM_p[j]=new Image;
d.MM_p[j++].src='media/mulan/images/'+a[i];
}
}
function showDialog(){
$('#hide1').css('display','block');
$('#hide1').css('width',document.documentElement.clientWidth);
$('#hide1').css('height',document.body.clientHeight );
$('#hidel').animate({'opacity':'0.8'},1500);
$('#bbs').css('display' ,'block');
$('#username').focus();
};
function closeDialog(){
$('#hide1').css('display','none');
$('#mailmsg').css('display' ,'none');
$('#bbs').css('display' ,'none');
$('#hidel').animate({'opacity':'0'},1500);
};
function isReady() {
$('#trytry').append('jsReady:'+jsReady+'>');
return jsReady;
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
function isComplete(){
var imgnum=0;
var imgcount=getImgCount();
$('#trytry').append('isComplete()>'+'imgcount:'+imgcount+'>');
$('img').each(function(){
var newImg = new Image();
newImg.onload = function(){
imgnum++;
$('#trytry').append('loadImg:'+imgnum+'/'+imgcount+'>');
thisMovie("flashloading").sendToActionScript(parseInt((imgnum/imgcount)*100));
if(imgnum==imgcount){
goEnter('imgnum==imgcount');
}
};
newImg.onerror=loadEro;
newImg.src = $(this).attr('src');
});
$('*').each(function(i){
if($(this).css('background-image')!='none'&&$(this).css('background-image')!=''){
var newImg2 = new Image();
newImg2.onload = function(){
imgnum++;
$('#trytry').append('loadImg:'+imgnum+'/'+imgcount+'>');
thisMovie("flashloading").sendToActionScript(parseInt((imgnum/imgcount)*100));
if(imgnum==imgcount){
goEnter('imgnum==imgcount');
}
};
newImg2.onerror=loadEro;
newImg2.src = $(this).css('background-image').match(/^url\("?([^"]+)"?\)$/)[1];
}
});
$('#enter').click(function(){
goEnter();
});
setTimeout('goEnter("timeout")',8000);
}
function getImgCount(){
var num=$('img').length;
$('*').each(function(){
if($(this).css('background-image')!='none'&&$(this).css('background-image')!=''){
num++;
}
});
return num;
}
function loadEro(){
$('#trytry').append('loaderror>');
goEnter('error');
}
function goEnter(msg){
$('#trytry').append('goEnter():'+msg+'>');
$('#loadflash').css('display','none');
$('body > div:not(#joomlawatch,#loadflash,#hide1,#mailmsg)').css('display','block');
}