var FlashControl = {GetFlash : function() {if (IsIE()) {return E("flashplayerie");} else {return E("flashplayerff");}},Play : function() {FlashControl.GetFlash().Play();},Pause : function() {if (IsIE()) {E("flashplayerie").Stop();} else {E("flashplayerie").StopPlay();}},GotoFrame : function(frame) {FlashControl.GetFlash().GotoFrame(frame);},GotoStart : function() {FlashControl.GotoFrame(0);},GotoEnd : function() {try{var flash = FlashControl.GetFlash();FlashControl.GotoFrame((IsIE()? flash.totalframes : flash.TotalFrames()) - 1);}catch(e){}},_loading_error : false,PercentLoaded  : function() {try{FlashControl._loading_error = false;var flash = FlashControl.GetFlash();return flash.PercentLoaded();}catch(e){FlashControl._loading_error = true; return 0;}},is_fullscreen : false,is_body_ready : false,is_absolute : true,is_loaded: true,is_locked: false,game_volume : 100,Report : function (id) {window.open("/report.htm?"+id, "", "Scrollbars=no,Toolbar=no,Location=no,Direction=no,Resizeable=no, Width=540 ,Height=240")},MusicOff : function () {try{E("game_control_music_off").style.display="none";E("game_control_s_music_off").style.display="none";E("game_control_music_on").style.display="";E("game_control_s_music_on").style.display="";FlashControl.game_volume = 0;FlashControl.GetFlash().SetVolume(0);} catch(e) {}},MusicOn : function () {try{E("game_control_music_on").style.display="none";E("game_control_s_music_on").style.display="none";E("game_control_music_off").style.display="";E("game_control_s_music_off").style.display="";FlashControl.game_volume = 100;FlashControl.GetFlash().SetVolume(100);} catch(e) {}},Fullscreen : function () {FlashControl.is_fullscreen = true;var game = E("flashplayer");if (IsIE()) {if (!FlashControl.is_body_ready) {setTimeout("FlashControl.Fullscreen()", 1000);return;}}if (FlashControl.is_absolute) {E("wrapper").style.display="none";if (E("pg_footer")) E("pg_footer").style.display="none";E("fullscreen_control").style.display="";game.style.left = "0px";game.style.top = "0px";						game.style.width = "100%";game.style.height = "100%";} else {game.parentNode.removeChild(game);document.body.appendChild(game);game.style.position = "absolute";}},EscapeFullscreen : function () {FlashControl.is_fullscreen = false;E("wrapper").style.display="";E("pg_footer").style.display="";E("fullscreen_control").style.display="none";var game = E("flashplayer");if (FlashControl.is_absolute) {setTimeout("FlashControl.CalcGamePos();", 100);} else {FlashControl.InsertGame();}},CheckUnload : function (e) {if (!FlashControl.is_fullscreen) return;e = window.event ? window.event : e;e.returnValue="Do you want to quit this game?";return "Do you want to quit this game?";},InsertGame: function() {var game = E("flashplayer");var target = E("flasharea");game.parentNode.removeChild(game);target.appendChild(game);game.style.position = "";game.style.display = "";},Reload: function() {var game = E("game_container");var html = game.innerHTML;var start = html.indexOf("<object");var end = html.indexOf("</object>");if (start >= 0 && end >= 0) {html = html.substring(start, end + 9);}game.innerHTML = html;if (FlashControl.game_volume == 0) {setTimeout("FlashControl.GetFlash().SetVolume(0);", 100);}},CalcGamePos : function() {if (FlashControl.is_locked) return;if (FlashControl.is_absolute) {if (!FlashControl.is_fullscreen) {var game = E("flashplayer");var pos = getElementPos("flasharea");if (FlashControl.is_loaded) {game.style.left = pos.x + "px";game.style.top = pos.y + "px";						game.style.width = E("flasharea").style.width;game.style.height = E("flasharea").style.height;} else {game.style.left = "0px";game.style.top = "0px";						game.style.width = "1px";game.style.height = "1px";}}}},Init : function (installprogress) {if (installprogress) FlashControl.is_loaded = false;if (FlashControl.is_absolute) {window.onresize = FlashControl.CalcGamePos;setTimeout("FlashControl.CalcGamePos()", 1000);if (!IsIE()) {window.onbeforeunload = function() {if (!FlashControl.is_fullscreen) return;return "Do you want to quit this game?";}}} else {FlashControl.InsertGame();}if (installprogress) {setTimeout("FlashControl._displayLoadProgress()", 100);}},load_times : 0,_displayLoadProgress : function() {var s = FlashControl.PercentLoaded();++ FlashControl.load_times;if (s < 0) {FlashControl.onGameLoaded();return;} else if (s == 100) {E("flashloadtext").innerHTML = "Download Completed";E("flashloadprogress").style.width = "100%";var min_times = 100;if (FlashControl.load_times >= min_times) {setTimeout("FlashControl.onGameLoaded()", 500);} else {FlashControl.GameStarter();}} else {if (FlashControl.load_times >= 50 && s == 0) {FlashControl.onGameLoaded();return;}E("flashloadtext").innerHTML = "Now Loading: " + s+"%";E("flashloadprogress").style.width = s+"%";setTimeout("FlashControl._displayLoadProgress()", 100);}},onGameLoaded: function() {if (FlashControl.is_loaded) return;E("flasharea").innerHTML = "";FlashControl.is_loaded = true;FlashControl.CalcGamePos();},gamestarter_timer : 10,GameStarter: function() {if (FlashControl.is_loaded) return;if (FlashControl.gamestarter_timer > 0) {E("flashloadtext").innerHTML = "<a href='#' onclick='FlashControl.onGameLoaded();return false'>Download Completed, click here to start! ("+FlashControl.gamestarter_timer+"s)</a>";--FlashControl.gamestarter_timer;setTimeout("FlashControl.GameStarter()", 1000);} else {FlashControl.onGameLoaded();}}};
function GameLoadError() {var game = E("game_container");var html = game.innerHTML;html = html.replace(/\/l\/[a-z\.0-9]+\.swf\?f=/g, "/flashes/");html = html.replace(/swf0/g, "swf");var start = html.indexOf("<object");var end = html.indexOf("</object>");if (start >= 0 && end >= 0) {html = html.substring(start, end + 9);}E("game_control_music_on").style.display="none";E("game_control_s_music_on").style.display="none";E("game_control_music_off").style.display="none";E("game_control_s_music_off").style.display="none";E("game_control_music_off").parentNode.style.display="none";FlashControl.game_volume = 100;game.innerHTML = html;}
function updateVotes(text) {try{eval("var data="+text);if (E("updiv")) E("updiv").style.width=data.uppct + "%";if (E("uptimes"))E("uptimes").innerHTML = data.uptimes;if (E("downdiv"))E("downdiv").style.width=data.downpct + "%";if (E("downtimes"))E("downtimes").innerHTML = data.downtimes;if (E("uppct"))E("uppct").innerHTML = data.uppct2d;if (E("notestarscore")) {E("notestarscore").parentNode.title = data.uppct2d + "% Good";E("notestarscore").style.width = data.uppct2d + "%";}return data;}catch(e){return null;}}
function vote(action, id, version) {var xmlrequest = createXMLHttpRequest();xmlrequest.onreadystatechange = function (){if ( xmlrequest.readyState == 4) {updateVotes(xmlrequest.responseText);E("votearea").innerHTML = "<img src=\"http://so.dressflash.com/st/css/ok.png\"></img>Thank you!";}};E("votearea").innerHTML = "<img src=\"http://so.dressflash.com/st/css/loading.gif\"></img>Submitting...";xmlrequest.open("POST", "/actions/vote.php?id=" + id + "&action=" + action, true);xmlrequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlrequest.send("");}
function getViewAndVote(id) {var xmlrequest = createXMLHttpRequest();xmlrequest.onreadystatechange = function (){if ( xmlrequest.readyState == 4) {try{var result = updateVotes(xmlrequest.responseText);E("viewsdiv").innerHTML = "Time played: " + result.views;} catch (e) {}}};try {xmlrequest.open("POST", "/actions/get_view_and_vote.php?id=" + id, true);xmlrequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); xmlrequest.send("");}catch(e){}}var __current_left = 0;var __step = 25;var __step_timer_id = null;var __step_timer_interval = 50;
function moveleft() {if (__step_timer_id) {clearTimeout(__step_timer_id);__step_timer_id = null;}try {if (__current_left == 0) return;__current_left -= __step;__current_left = Math.max(0, __current_left);E("game_slides").style.left = - __current_left + "px";if (__current_left > 0) __step_timer_id = setTimeout("moveleft()", __step_timer_interval);} catch(e) {}}
function moveright() {if (__step_timer_id) {clearTimeout(__step_timer_id);__step_timer_id = null;}try {if (E("game_slides1").scrollWidth <= E("game_slides0").offsetWidth) return;__current_left += __step;__current_left = Math.min(E("game_slides1").scrollWidth - E("game_slides0").offsetWidth, __current_left);E("game_slides").style.left = - __current_left + "px";if (__current_left < E("game_slides1").scrollWidth - E("game_slides0").offsetWidth) __step_timer_id = setTimeout("moveright()", __step_timer_interval);} catch(e) {}}
function endmove() {if (__step_timer_id) {clearTimeout(__step_timer_id);__step_timer_id = null;}}
function initSlide(index) {if (index < 0) return;try {var total = E("game_slides1").rows[0].cells.length;var step = E("game_slides1").scrollWidth / total;__current_left = index * step - E("game_slides0").offsetWidth / 2 + step / 2;__current_left = Math.min(E("game_slides1").scrollWidth - E("game_slides0").offsetWidth, __current_left);__current_left = Math.max(0, __current_left);E("game_slides").style.left = - __current_left + "px";} catch(e) {}}
function getGameComments(gid, start) {var xmlrequest = createXMLHttpRequest();xmlrequest.onreadystatechange = function (){if ( xmlrequest.readyState == 4) {if (xmlrequest.status == 200) {E("screenshots").innerHTML = xmlrequest.responseText;initLightbox();}}};E("screenshots").innerHTML = "<div style='padding:40px 0px;text-align:center;'><img src='http://so.dressflash.com/st/css/loading2.gif'></div>";try {xmlrequest.open("POST", "/actions/getcomments.php?id=" + gid + "&start=" + start, true);xmlrequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); xmlrequest.send("");}catch(e){}}
function OnCommentSubmitFinished(gid, keep) {E('btnsubmit').disabled=false;E('uploadform').style.display='';E('submitdiv').style.display='none';E("submitcommentframe").src = "about:blank";E('submitdivloading').style.display='';E('submitcommentframe').style.display='none';if (!keep) {E("commentform").reset();getGameComments(gid, 0);}}
function BeginClipImage() {E('uploadform').style.display='none';E('submitdiv').style.display='';E('submitdivloading').style.display='none';E('submitcommentframe').style.display='';}
function getFans(id) {if (!E("game_fans")) return;var xmlrequest = createXMLHttpRequest();xmlrequest.onreadystatechange = function (){if ( xmlrequest.readyState == 4) {if (xmlrequest.status == 200) {E("game_fans").innerHTML = xmlrequest.responseText;}}};xmlrequest.open("POST", "/actions/getfans.php?id=" + id, true);xmlrequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlrequest.send("");}