// JavaScript Document

fixWindow();

function fixWindow(){
	var dims = GetInnerSize();
	
	var newX = dims[0];
	if(dims[0] < 950) newX = 950;
	
	var newY = dims[1];
	if(dims[1] < 700) newY = 700;
	
	window.resizeDocTo(newX, newY);
	//alert(dims[0] + "," + dims[1] + "," + newX + "," + newY);
	}

function GetInnerSize () {
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	return [x,y];
}

function resizeDocTo(setw,seth){
	return window.resizeTo(setw,seth),window.resizeTo(setw*2-((typeof window.innerWidth ==
	'undefined')?document.body.clientWidth:window.innerWidth),seth*2-((typeof window.innerHeight ==
	'undefined')?document.body.clientHeight:window.innerHeight));
}

function openGallery(tag){
		Shadowbox.open({
        content:    "http://mobleytheband.com/images/TiltViewer.swf",
        player:     "swf",
        height:     600,
        width:      1000,
		//viewportPadding: 100,
		options:	{overlayOpacity:0.2,flashVars:{columns:4,rows:4,user_id:'43659392@N04',zoomedOutDistance:6000, textColor:0xFFFFFF, backColor:0x000000, bkgndInnerColor:0x171717, showFullscreenOption:false, linkLabel:"visit Mobley on flickr", showTakenByText:false, tags:tag.toString()}},
		gallery:	"video"
		});	
}

function openShadowbox(selector){
	//content, player, title, height, width){
    /*Shadowbox.open({
        content:    content,
        player:     player,
        title:      title,
		height:		height,
		width:		width,
		options:	{flashVars:{clip_id:2971938,autoplay:'true'}}
    });*/
	switch(selector)
	{
		case 0:
		Shadowbox.open({
        content:    "http://vimeo.com/moogaloop.swf",
        player:     "swf",
        height:     338,
        width:      600,
		options:	{overlayOpacity:0.2,flashVars:{clip_id:2971938,autoplay:'true'}},
		gallery:	"video"
		});
		break;
		
		case 1:
		Shadowbox.open({
        content:    "http://vimeo.com/moogaloop.swf",
        player:     "swf",
        height:     451,
        width:      601,
		options:	{overlayOpacity:0.2,flashVars:{clip_id:7420802,autoplay:'true'}},
		gallery:	"video"
		});
		break;
		
		
		case 2:
		Shadowbox.open({
        content:    "http://vimeo.com/moogaloop.swf",
        player:     "swf",
        height:     451,
        width:      601,
		options:	{overlayOpacity:0.2,flashVars:{clip_id:7828751,autoplay:'true'}},
		gallery:	"video"
		});
		break;
		
		case 3:
		Shadowbox.open({
        content:    "http://vimeo.com/moogaloop.swf",
        player:     "swf",
        height:     451,
        width:      601,
		options:	{overlayOpacity:0.2,flashVars:{clip_id:7828933,autoplay:'true'}},
		gallery:	"video"
		});
		break;
		
		case 4:
		Shadowbox.open({
        content:    "http://vimeo.com/moogaloop.swf",
        player:     "swf",
        height:     451,
        width:      601,
		options:	{overlayOpacity:0.2,flashVars:{clip_id:7829025,autoplay:'true'}},
		gallery:	"video"
		});
		break;
		
		case 5:
		Shadowbox.open({
        content:    "http://vimeo.com/moogaloop.swf",
        player:     "swf",
        height:     451,
        width:      601,
		options:	{overlayOpacity:0.2,flashVars:{clip_id:7829082,autoplay:'true'}},
		gallery:	"video"
		});
		break;
		
		case 6:
		Shadowbox.open({
        content:    "http://vimeo.com/moogaloop.swf",
        player:     "swf",
        height:     451,
        width:      601,
		options:	{overlayOpacity:0.2,flashVars:{clip_id:8065016,autoplay:'true'}},
		gallery:	"video"
		});
		break;
		
	}
	
	
}


function loadLyrics(tag){
		var url = 'http://www.mobleytheband.com/lyrics/#' + tag;
		
		Shadowbox.open({
        content:    url,
        player:     "iframe",
        height:     600,
        width:      600,
		options:	{overlayOpacity:0.2}
		});
}

function launchMailer(){
		var url = 'http://www.mobleytheband.com/mailer/mailingList.php';
		
		Shadowbox.open({
        content:    url,
        player:     "iframe",
        height:     200,
        width:      400,
		options:	{overlayOpacity:0.2}
		});
}