// JScript source code

/*
 * Bassani Watermark Fever jQuery Plugin
 * Version 1.0.0 (24-JUL-2011)
 * @requires jQuery v1.3 or later

 * Copyright (c) 2011 Edson Luiz Bassani
 * Licensed under the MIT license:
 * http://www.opensource.org/licenses/mit-license.php
*/


var $j = jQuery.noConflict();
function watermark(id, watermarkText, watermarkColor, activeColor) {
	$j(id).val(watermarkText).css('color', watermarkColor).focus( function() {
		if($j(this).val() == watermarkText) {
			$j(this).val('');
			$j(this).css('color', activeColor);
		}
	}).blur( function() {
		if(!$j(this).val()) {
			$j(this).val(watermarkText).css('color', watermarkColor);
		}
	});
}

function toggleSubscription()
{
	if (jQuery("#subscriptionPane").css("top") == "0px")
	
		jQuery("#subscriptionPane").animate({
			top: -80
			  }, 1000, function() {
				
			  });
	
	else
	
		jQuery("#subscriptionPane").animate({
			top: 0
			  }, 1000, function() {
				
			  });
}

function subscribe()
{
	jQuery("#SubscribeID").css("display", "none");
	jQuery("#DoneSubscribeID").css("display", "inline");	
}

var leftMarginWidth;

var leftWidthArray = new Array(427, 224, 585, 371, 245, 570);
function getDifference() {
    
    var marginsWidth = jQuery("body").width() - 946;

    leftMarginWidth = marginsWidth/2
    
}


function newPositionCalc() {




    var PlusCalc = (jQuery("body").width() / 2) - (jQuery("#darkCircle").width() / 2);
		
        var strLeft = PlusCalc + "px";
        jQuery("#darkCircle").css("left", PlusCalc);

		
}

function SubscriptionPane() {




    var PlusCalc = (jQuery("body").width()-946)/2;
		
		jQuery("#subscriptionPane").css("left", PlusCalc);
		
}

function newPositionCalc2() {

    getDifference()

    var Icons = new Array();

    Icons = jQuery(".main-icon");


    for (var i = 0; i < Icons.length; i++) {

        var PlusCalc = leftWidthArray[i] + leftMarginWidth;

        var strLeft = PlusCalc + "px";

        jQuery(Icons[i]).css("left", PlusCalc);
    }
    

}

function StartShow()
{
	setTimeout("ShowImages()", 2000);
	
}

var flag=true;

function ShowImages()
{
	
	if(navigator.appName == "Microsoft Internet Explorer")
		{
			
			jQuery("#darkCircle").animate({
			opacity: 0.2
			  }, 300, function() {
				flag=false;
				
			  });
			  jQuery("#linkContainer").delay(400).fadeIn(600);
			 
		}
		else
		{
			jQuery("#darkCircle").animate({
			opacity: 0.5
			  }, 300, function() {
				flag=false;jQuery("#linkContainer").fadeIn(600);
			  });
		}
	 
		

		
}


function ShowImagesAlways()
{
	
	if(navigator.appName == "Microsoft Internet Explorer")
		{
			
			jQuery("#darkCircle").animate({
			opacity: 0.6
			  }, 300, function() {
				flag=false;
				
			  });
			  jQuery("#linkContainer").delay(400).fadeIn(600);
			 
		}
		else
		{
			jQuery("#darkCircle").animate({
			opacity: 1
			  }, 300, function() {
				flag=false;jQuery("#linkContainer").fadeIn(600);
			  });
		}
	 
		

		
}

function onHovering()
{
	if(navigator.appName == "Microsoft Internet Explorer")
		{
			
			jQuery("#darkCircle").animate({
			opacity: 0.6
			  }, 300, function() {
				
			  });
			 
			 
		}
		else
		{
			jQuery("#darkCircle").animate({
			opacity: 1
			  }, 300, function() {
				
			  });
		}
	
}

function onHoveringFinish()
{
	if(navigator.appName == "Microsoft Internet Explorer")
		{
			
			jQuery("#darkCircle").animate({
			opacity: 0.4
			  }, 300, function() {
				
				
			  });
			  
			 
		}
		else
		{
			jQuery("#darkCircle").animate({
			opacity: 0.6
			  }, 300, function() {
				
			  });
		}
	
}

function hideMenu()
{
	
	if(flag)
	{
		if(navigator.appName == "Microsoft Internet Explorer")
		{
			
			jQuery("#darkCircle").animate({
			opacity: 0.6
			  }, 300, function() {
				flag=false;
				
			  });
			  jQuery("#linkContainer").delay(400).fadeIn(600);
			 
		}
		else
		{
			jQuery("#darkCircle").animate({
			opacity: 1
			  }, 300, function() {
				flag=false;jQuery("#linkContainer").fadeIn(600);
			  });
		}
	}
	else
	{
		jQuery("#linkContainer").fadeOut(600);
		jQuery("#darkCircle").delay(400).animate({
		opacity: 0
	  }, 300, function() {
		flag=true;
	  });
		}
	
	}

// Header Transition

var firstImg = "#headerImg1";
var secondImg = "#headerImg2";
var tempImg;

var inOutFlag=0;

function StopRevolving(Flag)
{
	inOutFlag= Flag;
}

function transitionHeader() {

    setTimeout("makeMove()", 9000);
        
}


function makeMove()
{

    Cont1();
}

function Cont1() {

	if(inOutFlag==0)
	{
		jQuery(secondImg).fadeOut(500); 
		setTimeout('Cont2()', 9000);
	}
	
}

function Cont2() {
	
	calculateNext();
		
    var ImageName = "images/header-" + nxtCalNum + ".jpg";
    jQuery(secondImg).attr("src", ImageName);
	if(inOutFlag==0)
	{
    jQuery(secondImg).fadeIn(500);
    setTimeout('Cont3()', 9000);
	}
}

function Cont3() {
    calculateNext();
		
    var ImageName = "images/header-" + nxtCalNum + ".jpg";
    jQuery(firstImg).attr("src", ImageName);
    makeMove()
}

var preCalNum = 1;
var nxtCalNum = 0;
function calculateNext()
{
	nxtCalNum = Math.floor(Math.random() * 7);
	if(nxtCalNum == preCalNum)
	{
	
	calculateNext();	
		}
	 preCalNum= nxtCalNum;
}




function switchImages() {
    tempImg = showedImg;
    showedImg = hiddenImg;
    hiddenImg = tempImg;
}


var arrImgs= ["images/main-img-1.jpg", "images/main-img-2.jpg", "images/main-img-3.jpg", "images/main-img-4.jpg", "images/main-img-5.jpg"];
var counter= 2;

function mainAnimation()
{
	var animationSpeed = 1500;
	var animationDelay = 7000;

	
	
	jQuery('#MainContainer2').delay(animationDelay).fadeOut(animationSpeed, function(){

		jQuery('#MainContainer2').css("background-image", "url("+ arrImgs[counter] +")");
		counter= counter + 1;
		if(counter==arrImgs.length)
		{
			
			counter=0;	
		}
		   
		jQuery('#MainContainer2').delay(animationDelay).fadeIn(animationSpeed, function(){
			jQuery('#MainContainer').css("background-image", "url("+ arrImgs[counter] +")");
			counter= counter + 1;
			if(counter==arrImgs.length)
			{
				
				counter=0;	
			}
			mainAnimation();
			});
	
	});

	
	
	
	
	
}

function changeImageMain()
{
	jQuery("#MainContainer").css({ backgroundImage : "url(images/main0.jpg)" });
	ContMain1();
	}

function ContMain1()
{
	if(navigator.appName == "Microsoft Internet Explorer")
		{
			jQuery("#MainContainer").css("backgroundPosition", "-946px 0px");
		}
		else
		{
			jQuery("#MainContainer").animate({backgroundPosition: '-946px 0px'}, 500, function() {
			// Animation complete.
		  });
		}
  setTimeout("ContMain2()", 5000);
}

function ContMain2()
{
	if(navigator.appName == "Microsoft Internet Explorer")
		{
			jQuery("#MainContainer").css("backgroundPosition", "-1892px 0px");
		}
		else
		{
			jQuery("#MainContainer").animate({backgroundPosition: '-1892px 0px'}, 500, function() {
			// Animation complete.
		  });
		}
  setTimeout("ContMain3()", 7000);
}

function ContMain3()
{
	if(navigator.appName == "Microsoft Internet Explorer")
		{
			jQuery("#MainContainer").css("backgroundPosition", "-2838px 0px");
		}
		else
		{
			jQuery("#MainContainer").animate({backgroundPosition: '-2838px 0px'}, 500, function() {
			// Animation complete.
		  });
		}
	
  setTimeout("ContMain4()", 7000);

}

function ContMain4()
{
	if(navigator.appName == "Microsoft Internet Explorer")
		{
			jQuery("#MainContainer").css("backgroundPosition", "-3784px 0px");
		}
		else
		{
			jQuery("#MainContainer").animate({backgroundPosition: '-3784px 0px'}, 500, function() {
			// Animation complete.
		  });
		}
	
  setTimeout("ContMain5()", 7000);
}

function ContMain5()
{
	if(navigator.appName == "Microsoft Internet Explorer")
		{
			jQuery("#MainContainer").css("backgroundPosition", "-0px 0px");
		}
		else
		{
			jQuery("#MainContainer").animate({backgroundPosition: '-0px 0px'}, 500, function() {
			// Animation complete.
		  });
		}
	
  setTimeout("ContMain1()", 7000);
}

var ShowingDiv="#StarterMenu";

function ShowMenu(PressedDiv)
{
		jQuery(ShowingDiv).css("display", "none");
		jQuery(PressedDiv).css("display", "block");
		
		ShowingDiv=PressedDiv;
}


