//remove loading screen

$(window).load(function() { hide_loading_screen();});

function display_loading_screen()
{
  document.getElementById('loading_screen').style.opacity = 1;
  document.getElementById("loading_screen").style.display = 'block'; 
}


function hide_loading_screen()
{
	setTimeout("document.getElementById('loading_screen').style.opacity = '0'", 1200);
 	setTimeout("document.getElementById('loading_screen').style.display = 'none'", 1800);
 	$("#masterWrapper").css("display","block");
}

//end Loading screen functionality.

//Screen resizing functionality
function resizeWindow()
{
//	if (parseInt(navigator.appVersion)>3) {
//		 if (navigator.appName.indexOf("Microsoft")!=-1)
//		 {
//		  winW = document.body.offsetWidth;
//		  winH = document.body.offsetHeight;
//		 }
//		 else
//		 {
		 winW = window.innerWidth;
		 winH = window.innerHeight;
		 
		 if ((winW == null) || (winH == null))
		 {
		 	winW = $(window).width();
		 	winH = $(window).height();
		 }
//		 }
//	}	 

$("#masterWrapper").css("width", winW+"px").css("height", winH+"px");
$("div.page").css("width", winW+"px").css("height", winH+"px");
$("div.site_wrapper").css("width", (winW*4)+"px").css("height", (winH*2)+"px");
$("div.leftSide").css("width", (winW*2)+"px");
$("#connect_container").css("width", (winW*2)+"px").css("height", (winH*2)+"px");
$("#explore_container").css("width", (winW*2)+"px").css("height", (winH*2)+"px");
$("div.content_container").css("width", (winW*2)+"px").css("height", (winH*2)+"px");
$("div.overlay_container").css("width", (winW*2)+"px").css("height", (winH*2)+"px");

regroupThumbs();
}

//END Screen resizing functionality


function openIndexMenu(side)
{
if(side == "explore")
	{
	if(document.getElementById(side).style.left == "0px")
		{
		document.getElementById(side).style.left = "";
		}
	else
		{
		if(document.getElementById("connect").style.right == "0px")
			{
			document.getElementById("connect").style.right = ""
			}
		document.getElementById(side).style.left = "0px";
		}

	}
if (side == "connect")
	if(document.getElementById(side).style.right == "0px")
	{
		document.getElementById(side).style.right = "";
	}
	else
	{
		if(document.getElementById("explore").style.left == "0px")
		{
		document.getElementById("explore").style.left = ""
		}
		document.getElementById(side).style.right = "0px";
	}
}



//touch scrolling

function isTouchDevice(){
	try{
		document.createEvent("TouchEvent");
		return true;
	}catch(e){
		return false;
	}
}
function touchScroll(id){
	if(isTouchDevice()){ //if touch events exist...
		var el=document.getElementById(id);
		var scrollStartPos=0;
		console.log("worked");
		document.getElementById(id).addEventListener("touchstart", function(event) {
			scrollStartPos=this.scrollTop+event.touches[0].pageY;
			event.preventDefault();
		},false);

		document.getElementById(id).addEventListener("touchmove", function(event) {
			this.scrollTop=scrollStartPos-event.touches[0].pageY;
			event.preventDefault();
		},false);
	}
}


/*----------------- iPad Functionality ------------------*/
   function BlockMove(event) {
	   // Tell Safari not to move the window.
	   event.preventDefault() ;
   }
/*----------------- END iPad Functionality ------------------*/   
   
/*----------------- Tab Functionality ------------------*/
   
   function tabSwitch_2(projNum, active, number, tab_prefix, content_prefix) {  
	   
	      $( "#projText"+projNum+" .content").css("display", "none");  
	      $( "#projText"+projNum+" ul li a").removeClass('active');  
 
	    $( "#projText"+projNum+" #"+content_prefix+active).css("display", "block");  
	    $( "#projText"+projNum+" #"+tab_prefix+active).addClass('active');    
	}  
   
/*----------------- END Tab Functionality ------------------*/
