swfobject.embedSWF("./styles/prosilver/template/wotlk_intro.swf", "wotlk_intro", "520", "163", "9.0.0", 
"expressInstall.swf", {}, { play : "true", loop : "true", quality : "best", wmode : "opaque", autoplay : "true", autostart : "true" }, {});

function utf8_encode ( string ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: sowberry
    // +    tweaked by: Jack
    // +   bugfixed by: Onno Marsman
    // +   improved by: Yves Sucaet
    // +   bugfixed by: Onno Marsman
    // *     example 1: utf8_encode('Kevin van Zonneveld');
    // *     returns 1: 'Kevin van Zonneveld'
 
    string = (string+'').replace(/\r\n/g, "\n").replace(/\r/g, "\n");
 
    var utftext = "";
    var start, end;
    var stringl = 0;
 
    start = end = 0;
    stringl = string.length;
    for (var n = 0; n < stringl; n++) {
        var c1 = string.charCodeAt(n);
        var enc = null;
 
        if (c1 < 128) {
            end++;
        } else if((c1 > 127) && (c1 < 2048)) {
            enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);
        } else {
            enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);
        }
        if (enc != null) {
            if (end > start) {
                utftext += string.substring(start, end);
            }
            utftext += enc;
            start = end = n+1;
        }
    }
 
    if (end > start) {
        utftext += string.substring(start, string.length);
    }
 
    return utftext;
}

function utf8_decode ( str_data ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
    // +      input by: Aman Gupta
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Norman "zEh" Fuchs
    // +   bugfixed by: hitwork
    // +   bugfixed by: Onno Marsman
    // *     example 1: utf8_decode('Kevin van Zonneveld');
    // *     returns 1: 'Kevin van Zonneveld'
 
    var tmp_arr = [], i = ac = c1 = c2 = c3 = 0;
 
    str_data += '';
 
    while ( i < str_data.length ) {
        c1 = str_data.charCodeAt(i);
        if (c1 < 128) {
            tmp_arr[ac++] = String.fromCharCode(c1);
            i++;
        } else if ((c1 > 191) && (c1 < 224)) {
            c2 = str_data.charCodeAt(i+1);
            tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));
            i += 2;
        } else {
            c2 = str_data.charCodeAt(i+1);
            c3 = str_data.charCodeAt(i+2);
            tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
            i += 3;
        }
    }
 
    return tmp_arr.join('');
}

function updateTeamspeakPanel()
{
	if ($('teamspeak-panel')) {
		new Ajax.Request('/forum/TS_start.php', {
		  method: 'get',
		  onSuccess: function(transport) {
        if (transport.responseText.length > 0) {
          $('teamspeak-panel').removeClassName('ajax-loading');
          $('teamspeak-flexcroll').update(transport.responseText);
          CSBfleXcroll('teamspeak-flexcroll');
          $$('#teamspeak-panel .refreshlink').each(function(el) {
            Event.observe(el, 'click', function(event) {
              var a = new Element('div', { 'id': 'teamspeak-flexcroll' }).update('');
              $('teamspeak-flexcroll').replace(a);
              $('teamspeak-panel').addClassName('ajax-loading');
              updateTeamspeakPanel();
              Event.stop(event);
            });
          });
        } else	{
          $('teamspeak-panel').update("Chargement impossible");
        }
		  }
		});
	}
}

function loadjscssfile(filename, filetype){
    if (filetype=="js"){ //if filename is a external JavaScript file
	var fileref=document.createElement('script')
	    fileref.setAttribute("type","text/javascript")
	    fileref.setAttribute("src", filename)
	    }
    else if (filetype=="css"){ //if filename is an external CSS file
	var fileref=document.createElement("link")
	    fileref.setAttribute("rel", "stylesheet")
	    fileref.setAttribute("type", "text/css")
	    fileref.setAttribute("href", filename)
	    }
    if (typeof fileref!="undefined")
	document.getElementsByTagName("head")[0].appendChild(fileref)
}


Event.observe(window, 'load', function() {

	if ($$('.section-portal').length > 0)
	{
		updateTeamspeakPanel();
	}

	if ($('menu_connexion'))
	{
		Event.observe($('menu_connexion'), 'click', function(event) {
			Event.stop(event);
			Lightview.show({
			href: './ajax/form_login.php',
			rel: 'ajax',
			options: {
				autosize: true,
				topclose: true,
				ajax: {
				method: 'get',
					evalScripts: true,
					onComplete: function(){
						$('name').focus();
					}
				}
			}
			});
		});
	}
	
	if ($('woworga_calendar'))
	{
    new Ajax.Updater('woworga_calendar', '/woworga/ajax/calendar.php', {
      encoding : 'ISO-8859-1'
    });
	}
	
	if ($$('.chatform input#message').length > 0)
	{
		new Ajax.Autocompleter($$('.chatform input#message')[0], 'chatbox_autocomplete', "/forum/ajax/chatbox_autocomplete.php");
		Event.observe($$('.chatform input#message')[0], 'keydown', function(event) {
			var el = Event.element(event);
			if ($('chatbox_autocomplete').getStyle('display') == 'none') {
				var key = event.which || event.keyCode;
				if (key == Event.KEY_DOWN) {
					if (chatbox_histo_current_pos == 0) {
						chatbox_histo[0] = el.value;
					}
					if (chatbox_histo_current_pos + 1 < chatbox_histo.length) {
						chatbox_histo_current_pos += 1;
						el.value = chatbox_histo[chatbox_histo_current_pos];
					}
				}
				else if (key == Event.KEY_UP) {
					if (chatbox_histo_current_pos > 0) {
						chatbox_histo_current_pos -= 1;
						el.value = chatbox_histo[chatbox_histo_current_pos];
					}
				}
			}
		});
	}

	loadjscssfile("http://www.wowhead.com/widgets/power.js", "js");

});