// JavaScript Document
$(document).ready(function() {
	var rimg = new Array();
	var rsrc = new Array();
	$('#synopsisc').fadeOut(0);
	$('#castc').fadeOut(0);
	$('#trailersc').fadeOut(0);
	$('#pressc').fadeOut(0);
	$('#photosc').fadeOut(0);
	$('.copy').fadeOut(0);
	$('.menu').hide(0);
	for (i=1; i<=6; i++) {
		$('.row' + i + 'aback').fadeOut(0);
		$('.row' + i + 'bback').fadeOut(0);
	}
	$('.insiglogo').hide(0);
	$('.amazonlogo').hide(0);
	$('.blockbusterlogo').hide(0);
	$('.netflixlogo').hide(0);
	$('.facebooklogo').hide(0);
	$('.mhome').hide(0);
	$('.menu').hover(
	  function() {
		if ($(this).is('.selected') == false) {
		  $(this).animate({'letter-spacing' :'3px'}, 500);
		  	//alert($(this).is('.selected'));
		}
	},
  function() {
	  if ($(this).is('.selected') == false) {
		$(this).animate({'letter-spacing' :'-3px'}, 500);
	  }
	}
	);
	$('.menu').click(
	  function() {
		$('.menu').removeClass('selected');
		$('.menu').css({'letter-spacing' :'-3px'});
		$(this).css({'letter-spacing' :'3px'});
		$(this).toggleClass('selected');
	});
	$('#synopsis').click(
	function() {
		$('.insiglogo').hide(0);
		$('#castc').fadeOut(0);
		$('#trailersc').fadeOut(0);
		$('#pressc').fadeOut(0);
		$('#photosc').fadeOut(0);
		$('#synopsisc').fadeIn(500);
	});
	$('#cast').click(
	function() {
		$('.insiglogo').hide(0);
		$('#synopsisc').fadeOut(0);
		$('#trailersc').fadeOut(0);
		$('#pressc').fadeOut(0);
		$('#photosc').fadeOut(0);
		$('#castc').fadeIn(500);
	});
	$('#trailers').click(
	function() {
		$('.insiglogo').hide(0);
		$('#synopsisc').fadeOut(0);
		$('#castc').fadeOut(0);
		$('#pressc').fadeOut(0);
		$('#photosc').fadeOut(0);
		$('#trailersc').fadeIn(500);
	});
	$('#press').click(
	function() {
		$('.insiglogo').hide(0);
		$('#synopsisc').fadeOut(0);
		$('#castc').fadeOut(0);
		$('#trailersc').fadeOut(0);
		$('#photosc').fadeOut(0);
		$('#pressc').fadeIn(500);
	});
	$('#photos').click(
	function() {
		$('.insiglogo').hide(0);
		$('#synopsisc').fadeOut(0);
		$('#castc').fadeOut(0);
		$('#trailersc').fadeOut(0);
		$('#pressc').fadeOut(0);
		$('#photosc').fadeIn(500);
	});
	$('.mhome').click(
	function() {
$('.insiglogo').hide(0);
		$('.menu').removeClass('selected');
		$('.menu').css({'letter-spacing' :'-3px'});
		$('#synopsisc').fadeOut(0);
		$('#castc').fadeOut(0);
		$('#trailersc').fadeOut(0);
		$('#pressc').fadeOut(0);
		$('#photosc').fadeOut(0);
		$('.insiglogo').fadeIn(500);
	});
});
function rowrfade(rRow) {
//var rRow = Math.ceil(Math.random() * 6);
var rDelay = Math.ceil((Math.random() * 4)) * 1000;
var fTimer = 5000;
$('.row' + rRow + 'aback').delay(rDelay).fadeToggle(fTimer);
$('.row' + rRow + 'bback').delay(rDelay).fadeToggle(fTimer,
function() {
	rowrfade(rRow)
});
};
$(window).load(function() {
	$('.loading').delay(500).fadeOut(800, 
	function() {
	  $('.menu').fadeIn(1500);
	  $('.insiglogo').fadeIn(1500);
	  $('.amazonlogo').fadeIn(1500);
	  $('.blockbusterlogo').fadeIn(1500);
	  $('.netflixlogo').fadeIn(1500);
	  $('.facebooklogo').fadeIn(1500);
	  $('.mhome').fadeIn(1500);
	  $('.copy').fadeIn(1500);
	  $('.row1aback').fadeIn(1500);
	  $('.row2aback').fadeIn(1500);
	  $('.row3aback').fadeIn(1500);
	  $('.row4aback').fadeIn(1500);
	  $('.row5aback').fadeIn(1500);
	  $('.row6aback').fadeIn(1500, 
	  function() {	
		for (i = 1; i < 7; i++) {
		rowrfade(i);
		}
	  });
	});
});
function JH_Play_Video(PageTitle, VideoTitle, Videofile)
{
  var wWidth = 650;
  var wHeight = 450;
  var cWidth = (window.screen.width - wWidth) / 2;
  var cHeight = (window.screen.height - wHeight) / 2;
  new_window = open("","","width=" + wWidth + ",height=" + wHeight + ",location=0,menubar=0,resizable=0,toolbar=0,directories=0,status=0,left=" + cWidth + ", top=" + cHeight);
  new_window.document.open();
  new_window.document.write("<html>\r<head>\r<title>" + PageTitle + " " + VideoTitle + "</title>\r</head>\r");
  new_window.document.write("<body bgcolor='#000000'  leftmargin='0px' topmargin='0px' rightmargin='0px' bottommargin='0px'>\r");
  new_window.document.write("<center>\r");
  new_window.document.write("<table>\r");
  new_window.document.write("  <tr>\r");
  new_window.document.write("    <td align='right'>\r");
  new_window.document.write("    <img src='images/insig_logo_rightjustified.jpg' />\r");
  new_window.document.write("    </td>\r");
  new_window.document.write("  </tr>\r");
  new_window.document.write("  <tr>\r");
  new_window.document.write("    <td>\r");
  new_window.document.write("    <object width='576' height='324' >\r");
  new_window.document.write("    <param name='allowfullscreen' value='true' />\r");
  new_window.document.write("    <param name='allowscriptaccess' value='always' />\r");
  new_window.document.write("    <param name='movie' value='" + Videofile + "' />\r");
  new_window.document.write("    <embed src='" + Videofile + "' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='576' height='324'>\r");
  new_window.document.write("    </embed>\r");
  new_window.document.write("    </object>\r");
  new_window.document.write("    </td>\r");
  new_window.document.write("  </tr>\r");
  new_window.document.write("  <tr>\r");
  new_window.document.write("    <td>\r");
  new_window.document.write("    <a href='http://www.facebook.com/pages/INSIGNIFICANT-OTHERS/149169495257?ref=ts' target='_blank'><img src='images/subpic_facebook.jpg' border='0'></a>\r");
  new_window.document.write("    </td>\r");
  new_window.document.write("  </tr>\r");
  new_window.document.write("</table>\r");
  new_window.document.write("</center>\r");
  new_window.document.write("</body>\r</html>\r");
  new_window.document.close(); 
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
$(function() {
$("#portwrap").scrollable({
		 size: 5
		});
});
