// Hide/show grey lightbox-esque background
function overlay() {
    new Effect.Appear($('downloads-overlay'), {
        duration: 1,
        from: 0.0,
        to: 0.7,
        queue: 'end'
    });
}

function closeOverlay() {
    new Effect.Fade($('downloads-overlay'), {
        duration: 1,
        queue: 'end'
    });
}


function showScreenshots() {
    new Effect.Appear($('screenshots-window'), {
        duration: 1,
        from: 0.0,
        to: 1.0,
        queue: 'end'
    });
}

function hideScreenshots() {
    new Effect.Fade($('screenshots-window'), {
        duration: 1,
        queue: 'end'
    });
}

function showFullScreenshot(arg,caption) {
    imgSrc = "/data/games/rometw/images/media/screenshots/" + arg;
    $('fullscreen').src = imgSrc;
    new Effect.Appear($('fullscreen-window'), {
        duration: 1,
        queue: 'end'
    });
// Get the P from the DIV
	$('fullscreen-caption').firstDescendant().update(caption);
}

function hideFullScreenshot() {
    new Effect.Fade($('fullscreen-window'), {
        duration: 0.5,
        queue: 'end'
    });
}

function showDesktops() {
    new Effect.Appear($('desktops-window'), {
        duration: 1,
        from: 0.0,
        to: 1.0,
        queue: 'end'
    });
}

function hideDesktops() {
    if ($('fulldesk-window').getStyle('display') != "none")
    hideFullDesk();
    new Effect.Fade($('desktops-window'), {
        duration: 1,
        queue: 'end'
    });
    closeOverlay();
}
function fullDesktop(arg) {
    new Effect.Appear($('fulldesk-window'), {
        duration: 0.5,
        queue: 'end'
    });
    imgSrc = "/data/games/rometw/images/media/desktops/thumbs/" + arg + ".jpg";
    deskPath = "/data/games/rometw/images/media/desktops/" + arg + "_";
    $('fulldesk-thumb').src = imgSrc;
    $('desk1920').href = deskPath + "1920.jpg";
    $('desk1680').href = deskPath + "1680.jpg";
    $('desk1440').href = deskPath + "1440.jpg";
    $('desk1280').href = deskPath + "1280.jpg";
}

function hideFullDesk() {
    new Effect.Fade($('fulldesk-window'), {
        duration: 0.5,
        queue: 'end'
    });
}

function fullTrailer(arg){
	new Effect.Appear($('fulltrailer-window'), {duration: 0.5, queue: 'end'});
	imgSrc = "/data/games/rometw/images/media/trailers/trailer1.jpg";
	trailerPath = "/data/games/rometw/trailers/";
	$('fulltrailer-thumb').src=imgSrc;
	$('trailerlarge').href=trailerPath+"large.mov"
	$('traileripod').href=trailerPath+"iPod.m4v"
}
function hideFullTrailer() {
    new Effect.Fade($('fulltrailer-window'), {
        duration: 0.5,
        queue: 'end'
    });
}
function showDemo() {
    new Effect.Appear($('demo-window'), {
        duration: 1,
        from: 0.0,
        to: 1.0,
        queue: 'end'
    });
}

function hideDemo() {
    new Effect.Fade($('demo-window'), {
        duration: 1,
        queue: 'end'
    });
}

/* function embedQT() {
	document.write('<div id = "storymovie">\n')
	document.write('<object CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="320" height="225" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">\n');
	document.write('<param name="src" value="data/games/rometw/images/story/story1.mov"/>\n');
//	document.write('<param name="qtsrc" value="story1.mov"/>\n');
	document.write('<param name="autoplay" value="true"/>\n');
	document.write('<param name="loop" value="true"/>\n');
	document.write('<param name="controller" value="false"/>\n');
	document.write('<embed src="data/games/rometw/images/story/story1.mov" width="320" height="225" autoplay="true" loop="true" controller="false" pluginspage="http://www.apple.com/quicktime/"></embed>\n');
	document.write('</object>\n');
	document.write('</div>\n')
} Doesn't disappear when another AJAX occurs*/

// Shoehorn in our Quicktime movie
function embedQT(){
	document.getElementById('storymovie').innerHTML='<object CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="458" height="225" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab"> \
                                                   			<param name="src" value="data/games/rometw/images/story/story1.mov"/> \
                  											<param name="qtsrc" value="story1.mov"/> \
          	        										<param name="autoplay" value="true"/> \
         		 	        								<param name="loop" value="true"/> \
         		 	        								<param name="controller" value="false"/> \
         		 	        								<embed src="data/games/rometw/images/story/story1.mov" width="458" height="225" autoplay="true" loop="true" controller="false" pluginspage="http://www.apple.com/quicktime/"></embed> \
         		 	        								</object>';
}

// Called .. after ajax - otherwise this wouldn't be called when navigating subpages
function after_ajax(arg) {         
	if(arg == "story1")            
		embedQT();                 
}                                  
function showFaction(arg) {
	$('factionhelp').hide(); 
	$('factiontitle-'+arg).show(); 
	$('factionlogo-'+arg).show();
	$('factiontext-'+arg).show();
}
function hideFaction(arg) {
		$('factionhelp').show();
	$('factiontitle-'+arg).hide();
	$('factionlogo-'+arg).hide();
	$('factiontext-'+arg).hide();
}

function showMediaLabel(arg){
	$(arg+'label').show();
	$("bw"+arg).hide();
}
function hideMediaLabel(arg){
	$(arg+'label').hide();
	$("bw"+arg).show();
}

function preorderShine(){
	$('preorder-on').show();
	$('preorder-off').hide();
}

function preorderDull(){
	$('preorder-on').hide();
	$('preorder-off').show();
}
function preordersmShine(){
	$('preordersm-on').show();
	$('preordersm-off').hide();
}

function preordersmDull(){
	$('preordersm-on').hide();
	$('preordersm-off').show();
}
