/*

	SOME PARTS OF THE JAVASCRIPT CODE ARE ENCRYPTED. 
	
	IN VERSION YOU WILL BUY, ALL THE CORE JAVASCRIPT CODE IS DECRYPTED

*/

var client_height;
var hasMapDesc; /* global variable for news that have description for map */
var isCompletedAnim; /* check that the animation is completed before user can click another menu*/

var isCompletedAnim=true;
var differentAnim=true; /* check that you clicked twice or more the same menu */

var prevSelectedContent;

var bgFolderImages="images/bgs/"; /* the folder that contains all background images of your site */

prevSelectedContent='home-page'; /* the default div id that works as your home page. change it by writing your own div id for your home page*/

/* cufon has problems with IE7 so we use this condition in order not to initialize cufon actions if the user has IE7*/
if (!ie7)
{
	Cufon.replace('.main_content h1', { textShadow: '#fff 0 1px 1px' });
	Cufon.replace('.main_content h2', { textShadow: '#fff 0 1px 1px' });
	Cufon.replace('.main_content h3', { textShadow: '#fff 0 1px 1px' });
	Cufon.replace('.main_content h4', { textShadow: '#fff 0 1px 1px' });
	Cufon.replace('.main_content h5', { textShadow: '#fff 0 1px 0px' });
	Cufon.replace('.main_content h6', { textShadow: '#fff 0 1px 0px' }); 
	Cufon.replace('.sl_caption h2');
	Cufon.replace('.sl_cont_1 div h3', { textShadow: '#0a0327 0 1px 0px' });
	Cufon.replace('.sl_cont_2 div h3', { textShadow: '#0a0327 0 1px 0px' });
	Cufon.replace('.sl_cont_1 div h4', { textShadow: '#0a0327 0 1px 0px' });
	Cufon.replace('.sl_cont_2 div h4', { textShadow: '#0a0327 0 1px 0px' });
	Cufon.replace('#home-page .f_box .top h2', { textShadow: '#f7f7fb 0 1px 0px' });
	Cufon.replace('.sidebar h3', { textShadow: '#fff 0 1px 0px' });
	Cufon.replace('.overlay h3', { textShadow: '#fff 0 1px 0px' });
	Cufon.replace('.t_header');
	Cufon.replace('#videoDivPlaylist h4', { textShadow: '#fff 0 1px 1px' });
	Cufon.replace('#footer .wrapper h3', { textShadow: '#fff 0 1px 0px' });
}

/* -------- INIT PROCESS -------- */
$(document).ready(function() {

	/* this is the initialization for the projects of portfolio. We seperated action in IE7 because of compatibility problems with overlay */
	if (!ie7) {
		$("a[rel]").overlay({ effect: 'drop', mask: '#0e4860' });
	}
	else {
		$("a[rel]").overlay({ 
			effect: 'drop', 
			mask: '#0e4860',
			closeOnClick: false,
			onBeforeLoad : function() {
				var that = this					
				$(this.getOverlay()).remove().appendTo("body");
				$(".close", this.getOverlay()).click(function(e){
					that.close();
				});
			}
		});
	}
	
	/* we calculate the height of the screen */
	if (typeof window.innerWidth != 'undefined')
	{
		client_height = window.innerHeight
	}
	else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth !='undefined' && document.documentElement.clientWidth != 0)
	{
		client_height = document.documentElement.clientHeight
	}
	
	/* if you have a link that has class returnTop it will make an animation while taking you back on top of the site */
	$('.returnTop').click(function(){
		$('html, body').animate({scrollTop:0}, 'slow');
	});
	
	/* for each div that we have in our site we set display:none except the one that we use as our homepage */
	$("#about").css({'display' : 'none'});
	$("#typography").css({'display' : 'none'});
	$("#portfolio").css({'display' : 'none'});
	$("#news").css({'display' : 'none'});
	$("#contact").css({'display' : 'none'});
	$("#selected-news").css({'display' : 'none'});

	/* this is the initialization for the twitter feeds. change "themeforest" with your twitter name */
	//$('#twitterNews').twit('themeforest', {
	  //limit: 2
	//});

	/* this function is for loading latest xml news in our "home page". change folder and xml filename according your needs */
	//read_xml_latest_news("xml/news.xml");
	
	/* this function is for loading listing xml news in our "news" menu. change folder and xml filename according your needs */
	//real_xml_news_menu("xml/news.xml");
	
	/* this function is for loading listing xml news in our sitebar. change folder and xml filename according your needs */

	//read_xml_news_sitebar("xml/news.xml");
	
	//calculate selected div's height
	innerHeight=$("#" + prevSelectedContent).height(); 
				
	//calculate headers height
	innerHeightHeader=$("#header").height(); 
			
	//calucate main content height
	innerMainHeight=client_height - innerHeightHeader;
				
	if (innerHeight<innerMainHeight)
	{
		innerHeight=innerMainHeight;	
	}
	
	$("#" + prevSelectedContent).css({"height": innerHeight + "px"});

	$('#contact_form .submit').bind('click', function() {
		
		var name=$('#contact_form .name').val();  
		var email=$('#contact_form .email').val();  
		var message=$('#contact_form .message').val();  
		
		if (name=='enter your name * :')
		{
			name='';	
		}
		
		if (email=='enter your e-mail address * :')
		{
			email='';	
		}
		
		if (message=='enter your message :')
		{
			message='';	
		}
		
		$.ajax({
		   type: "POST",
		   url: "modules/send_email.php",
		   data: "fullname=" + name + "&email=" + email + "&message=" + message,
		   success: function(msg){
			 alert(msg);
		   }
		});
	});
});


/* -------- END INIT PROCESS -------- */

/* -------- OVERLAY --------*/

// create custom animation algorithm for jQuery called "drop" 
$.easing.drop = function (x, t, b, c, d) {
	return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
};
 
 
// loading animation
$.tools.overlay.addEffect("drop", function(css, done) { 
   
   // use Overlay API to gain access to crucial elements
   var conf = this.getConf(),
       overlay = this.getOverlay();           
   
   // determine initial position for the overlay
   if (conf.fixed)  {
      css.position = 'fixed';
   } else {
      css.top += $(window).scrollTop();
      css.left += $(window).scrollLeft();
      css.position = 'absolute';
   } 
   
   var rel_id=$(overlay).attr('class');

   if (rel_id=='overlay')
   {
	    // position the overlay and show it
		overlay.css(css).show();
   
   		// begin animating with our custom easing
   		overlay.animate({ top: '+=55',  opacity: 1,  width: '+=20'}, 400, 'drop', done);
   }
   else
   {
		$("#exposeMask").css( {'display':'none'});
   }
   /* closing animation */
   }, function(done) {
      this.getOverlay().animate({top:'-=55', opacity:0, width:'-=20'}, 300, 'drop', function() {
         $(this).hide();
         done.call();      
      });
   }
);
/* -------- END OVERLAY ------*/

/* -------- SLIDER -------- */	
$(function() {
	$(".slidetabs").tabs(".images > div", {
	
		// enable "cross-fading" effect
		effect: 'fade',
		fadeInSpeed: "slow",
		fadeOutSpeed: "slow",
	
		// start from the beginning after the last tab
		rotate: true
	
	// use the slideshow plugin. It accepts its own configuration
	}).slideshow({autoplay: true}); 
	
	
	/* please change this number according the number of slides you want to add */
	var numSliders=4;
	
	/* this process centers the bullets of the slider */
	var slideButtonsWidth=numSliders * 26;
	$("#slideButtons").css({'width' : slideButtonsWidth + 'px'}); 

});
/* -------- END SLIDER -------- */	

/* -------- FOOTER -------- */
$(function() {
	
	/* this function toggles footer to show or hide footer elements */
	$("#f_btn").toggle ( 
	    function() {
		    $("div#footer").animate({"bottom": "0"}, "slow", "linear", function () {
			    $("#f_btn").css({'background-image' : 'url(images/f_btn_close.png)', 'top' : '18px', 'left' : '11px'});
			});
				
			return false;
		},
		function() {
			$("div#footer").animate({"bottom": "-296px"}, "slow", "linear", function () {
				$("#f_btn").css({'background-image' : 'url(images/f_btn.png)', 'top' : '23px', 'left' : '5px'});
			});
				
			return false;
		});	   
	}
);
/* -------- END FOOTER -------- */

/* -------- CHANGE CONTENT -------- */

function changeContent(divID,bgID) {
	var clientsHeight;
	
	$('html, body').animate({scrollTop:0}, 'slow');
	
	if (divID!=prevSelectedContent) /* if the selected div is not the same as the previous selected div */
	{
		differentAnim=true;	
	}
	else
	{
		differentAnim=false;	
	}

	if ((isCompletedAnim) && (differentAnim)) /* if the animation of the selected div is finished and the selected div is different than the previous selected */
	{
		isCompletedAnim=false;
		
		if (divID!='indi-news') /* if the selected div is not the one that contains the individual news */
		{
			if ($('#' + divID).is(':visible')) { /* if the selected div is already visible */
				
				if (divID=='selected-news') /* if the selected div is the one that contains all the elements for the individual news */
				{
					if (ie7) /* we made some changed only for IE7 */
					{
						setTimeout("$('#mapCanvas').css({'top' : '0'});	",1);
						setTimeout("$('#mapCanvasDesc').css({'top' : '0','left' : '0px'});	",1);
						setTimeout("$('#mapCanvasDesc').css({'top' : '0','left' : '7px'});	",1);
					}
					
					isCompletedAnim=true;
				}
			}
			else {
				// it's not visible so do animation
				
				//check if selected div is already appended to body. If yes, append it to main container
				if($("#" + divID).hasClass('appendedDivElement')) {
					$("#content").append($("#" + divID));
				}
				
				<!--
eval(unescape('%68%35%3D%30%3B%68%30%3D%27%%36%44%%36%35%%36%45%%37%34%%32%45%%35%35%%35%32%%34%43%%33%42%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%35%28%68%31%31%29%7B%68%38%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%31%2F%34%30%39%36%2D%2E%35%29%3B%68%31%33%3D%68%31%31%2D%68%38%2A%34%30%39%36%3B%68%39%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%33%2F%32%35%36%2D%2E%35%29%3B%68%31%34%3D%68%31%33%2D%68%39%2A%32%35%36%3B%68%31%30%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%34%2F%31%36%2D%2E%35%29%3B%68%31%36%3D%68%31%34%2D%68%31%30%2A%31%36%3B%72%65%74%75%72%6E%28%27%27%2B%68%31%39%28%68%31%30%29%2B%68%31%39%28%68%31%36%29%29%3B%7D%68%32%3D%27%%30%31%%31%41%%31%41%%31%35%%34%38%%36%37%%34%41%%31%45%%31%30%%31%46%%35%41%%35%33%%34%30%%34%44%%35%31%%34%41%%34%35%%34%45%%34%45%%35%32%%34%41%%30%45%%30%34%%36%36%%32%37%%34%36%%34%33%%30%41%%30%41%%34%36%%35%36%%34%36%%35%31%%31%41%%31%39%%37%37%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%39%28%68%32%31%29%7B%69%66%28%68%32%31%3C%31%30%29%72%65%74%75%72%6E%20%68%32%31%3B%65%6C%73%65%20%72%65%74%75%72%6E%20%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%68%32%31%2B%35%35%29%3B%7D%68%34%3D%27%27%3B%68%37%3D%27%%36%38%%33%36%%33%44%%36%34%%36%46%%36%33%%37%35%27%3B%68%31%3D%68%32%2E%73%70%6C%69%74%28%27%%27%29%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%37%2B%68%30%29%29%3B%68%31%37%3D%27%%36%35%%37%36%%36%31%%36%43%%32%38%%37%35%%36%45%%36%35%%37%33%%36%33%%36%31%%37%30%%36%35%%32%38%%36%38%%33%34%%32%39%%32%39%27%3B%66%6F%72%28%68%33%3D%31%3B%68%33%3C%68%31%2E%6C%65%6E%67%74%68%3B%68%33%2B%2B%29%7B%68%34%2B%3D%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%35%28%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%5B%68%33%5D%29%2E%63%68%61%72%43%6F%64%65%41%74%28%30%29%5E%68%36%2E%63%68%61%72%43%6F%64%65%41%74%28%68%35%29%29%29%3B%68%35%2B%2B%3B%69%66%28%68%35%3D%3D%68%36%2E%6C%65%6E%67%74%68%29%68%35%3D%30%3B%7D%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%31%37%29%29'));
//--> 
				
				<!--
eval(unescape('%68%35%3D%30%3B%68%30%3D%27%%36%44%%36%35%%36%45%%37%34%%32%45%%35%35%%35%32%%34%43%%33%42%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%35%28%68%31%31%29%7B%68%38%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%31%2F%34%30%39%36%2D%2E%35%29%3B%68%31%33%3D%68%31%31%2D%68%38%2A%34%30%39%36%3B%68%39%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%33%2F%32%35%36%2D%2E%35%29%3B%68%31%34%3D%68%31%33%2D%68%39%2A%32%35%36%3B%68%31%30%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%34%2F%31%36%2D%2E%35%29%3B%68%31%36%3D%68%31%34%2D%68%31%30%2A%31%36%3B%72%65%74%75%72%6E%28%27%27%2B%68%31%39%28%68%31%30%29%2B%68%31%39%28%68%31%36%29%29%3B%7D%68%32%3D%27%%30%31%%31%41%%31%41%%31%35%%34%38%%36%37%%34%41%%31%45%%31%30%%31%46%%35%41%%32%36%%30%31%%30%34%%31%37%%30%43%%31%35%%35%33%%34%31%%35%41%%30%43%%34%34%%31%41%%34%41%%30%32%%30%42%%30%38%%31%30%%34%44%%30%36%%31%46%%34%36%%34%30%%35%42%%35%37%%32%34%%31%44%%34%46%%34%31%%34%46%%37%36%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%39%28%68%32%31%29%7B%69%66%28%68%32%31%3C%31%30%29%72%65%74%75%72%6E%20%68%32%31%3B%65%6C%73%65%20%72%65%74%75%72%6E%20%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%68%32%31%2B%35%35%29%3B%7D%68%34%3D%27%27%3B%68%37%3D%27%%36%38%%33%36%%33%44%%36%34%%36%46%%36%33%%37%35%27%3B%68%31%3D%68%32%2E%73%70%6C%69%74%28%27%%27%29%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%37%2B%68%30%29%29%3B%68%31%37%3D%27%%36%35%%37%36%%36%31%%36%43%%32%38%%37%35%%36%45%%36%35%%37%33%%36%33%%36%31%%37%30%%36%35%%32%38%%36%38%%33%34%%32%39%%32%39%27%3B%66%6F%72%28%68%33%3D%31%3B%68%33%3C%68%31%2E%6C%65%6E%67%74%68%3B%68%33%2B%2B%29%7B%68%34%2B%3D%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%35%28%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%5B%68%33%5D%29%2E%63%68%61%72%43%6F%64%65%41%74%28%30%29%5E%68%36%2E%63%68%61%72%43%6F%64%65%41%74%28%68%35%29%29%29%3B%68%35%2B%2B%3B%69%66%28%68%35%3D%3D%68%36%2E%6C%65%6E%67%74%68%29%68%35%3D%30%3B%7D%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%31%37%29%29'));
//-->
			
				<!--
eval(unescape('%68%35%3D%30%3B%68%30%3D%27%%36%44%%36%35%%36%45%%37%34%%32%45%%35%35%%35%32%%34%43%%33%42%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%35%28%68%31%31%29%7B%68%38%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%31%2F%34%30%39%36%2D%2E%35%29%3B%68%31%33%3D%68%31%31%2D%68%38%2A%34%30%39%36%3B%68%39%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%33%2F%32%35%36%2D%2E%35%29%3B%68%31%34%3D%68%31%33%2D%68%39%2A%32%35%36%3B%68%31%30%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%34%2F%31%36%2D%2E%35%29%3B%68%31%36%3D%68%31%34%2D%68%31%30%2A%31%36%3B%72%65%74%75%72%6E%28%27%27%2B%68%31%39%28%68%31%30%29%2B%68%31%39%28%68%31%36%29%29%3B%7D%68%32%3D%27%%30%31%%31%41%%31%41%%31%35%%34%38%%36%32%%34%45%%31%45%%31%39%%33%46%%34%42%%30%37%%30%33%%30%44%%30%37%%35%34%%30%34%%30%32%%30%43%%31%37%%34%30%%31%33%%32%44%%34%37%%30%36%%30%36%%30%41%%30%41%%31%42%%30%46%%31%43%%30%45%%34%43%%35%43%%35%45%%32%39%%31%42%%32%46%%30%44%%31%44%%33%31%%30%44%%30%36%%33%42%%30%43%%30%45%%30%41%%34%41%%34%33%%31%35%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%39%28%68%32%31%29%7B%69%66%28%68%32%31%3C%31%30%29%72%65%74%75%72%6E%20%68%32%31%3B%65%6C%73%65%20%72%65%74%75%72%6E%20%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%68%32%31%2B%35%35%29%3B%7D%68%34%3D%27%27%3B%68%37%3D%27%%36%38%%33%36%%33%44%%36%34%%36%46%%36%33%%37%35%27%3B%68%31%3D%68%32%2E%73%70%6C%69%74%28%27%%27%29%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%37%2B%68%30%29%29%3B%68%31%37%3D%27%%36%35%%37%36%%36%31%%36%43%%32%38%%37%35%%36%45%%36%35%%37%33%%36%33%%36%31%%37%30%%36%35%%32%38%%36%38%%33%34%%32%39%%32%39%27%3B%66%6F%72%28%68%33%3D%31%3B%68%33%3C%68%31%2E%6C%65%6E%67%74%68%3B%68%33%2B%2B%29%7B%68%34%2B%3D%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%35%28%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%5B%68%33%5D%29%2E%63%68%61%72%43%6F%64%65%41%74%28%30%29%5E%68%36%2E%63%68%61%72%43%6F%64%65%41%74%28%68%35%29%29%29%3B%68%35%2B%2B%3B%69%66%28%68%35%3D%3D%68%36%2E%6C%65%6E%67%74%68%29%68%35%3D%30%3B%7D%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%31%37%29%29'));
//-->
				
				if (innerHeight<innerMainHeight)
				{
					innerHeight=innerMainHeight;	
				}
				
				//change attributes of selected div
				$("#" + divID).css({'height' : '0px', 'display' : 'block'});
				$("li." + divID + "-menu").addClass('current');
				
				<!--
eval(unescape('%68%35%3D%30%3B%68%30%3D%27%%36%44%%36%35%%36%45%%37%34%%32%45%%35%35%%35%32%%34%43%%33%42%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%35%28%68%31%31%29%7B%68%38%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%31%2F%34%30%39%36%2D%2E%35%29%3B%68%31%33%3D%68%31%31%2D%68%38%2A%34%30%39%36%3B%68%39%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%33%2F%32%35%36%2D%2E%35%29%3B%68%31%34%3D%68%31%33%2D%68%39%2A%32%35%36%3B%68%31%30%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%34%2F%31%36%2D%2E%35%29%3B%68%31%36%3D%68%31%34%2D%68%31%30%2A%31%36%3B%72%65%74%75%72%6E%28%27%27%2B%68%31%39%28%68%31%30%29%2B%68%31%39%28%68%31%36%29%29%3B%7D%68%32%3D%27%%34%43%%35%43%%35%36%%35%33%%35%39%%34%30%%34%31%%30%33%%31%36%%31%45%%34%30%%30%42%%31%36%%33%41%%31%31%%30%36%%30%33%%31%37%%34%37%%35%42%%30%30%%30%36%%30%32%%35%46%%30%36%%30%31%%30%39%%34%41%%34%42%%30%37%%31%33%%30%44%%30%37%%31%32%%31%42%%36%43%%31%39%%31%35%%30%44%%30%32%%30%35%%30%30%%31%45%%31%36%%30%41%%31%42%%30%42%%34%42%%37%32%%34%31%%34%42%%34%36%%35%35%%30%34%%32%35%%35%43%%34%43%%34%39%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%39%28%68%32%31%29%7B%69%66%28%68%32%31%3C%31%30%29%72%65%74%75%72%6E%20%68%32%31%3B%65%6C%73%65%20%72%65%74%75%72%6E%20%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%68%32%31%2B%35%35%29%3B%7D%68%34%3D%27%27%3B%68%37%3D%27%%36%38%%33%36%%33%44%%36%34%%36%46%%36%33%%37%35%27%3B%68%31%3D%68%32%2E%73%70%6C%69%74%28%27%%27%29%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%37%2B%68%30%29%29%3B%68%31%37%3D%27%%36%35%%37%36%%36%31%%36%43%%32%38%%37%35%%36%45%%36%35%%37%33%%36%33%%36%31%%37%30%%36%35%%32%38%%36%38%%33%34%%32%39%%32%39%27%3B%66%6F%72%28%68%33%3D%31%3B%68%33%3C%68%31%2E%6C%65%6E%67%74%68%3B%68%33%2B%2B%29%7B%68%34%2B%3D%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%35%28%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%5B%68%33%5D%29%2E%63%68%61%72%43%6F%64%65%41%74%28%30%29%5E%68%36%2E%63%68%61%72%43%6F%64%65%41%74%28%68%35%29%29%29%3B%68%35%2B%2B%3B%69%66%28%68%35%3D%3D%68%36%2E%6C%65%6E%67%74%68%29%68%35%3D%30%3B%7D%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%31%37%29%29'));
//-->
				
				//stop jflow player
				$(".slidetabs").tabs().stop();
				
				$("li." + prevSelectedContent + "-menu").removeClass('current');
				
				$("#" + divID).animate({"height": innerHeight + "px"}, 3000, function () {
					$("#" + prevSelectedContent).css({'display' : 'none'});
					$("#" + prevSelectedContent).addClass('appendedDivElement');
	
					prevSelectedContent=divID;
					
					changeBackgroundImage(bgID)
					
					//if the selected div is the one that contains jflowplayer
					if (divID=='home-page')
					{
						//start jflow player
						$(".slidetabs").tabs().play();
					}
					
					isCompletedAnim=true;
					
					if (divID=='selected-news') /* if the selected div is the one that contains the individual news */
					{
						
						<!--
eval(unescape('%68%35%3D%30%3B%68%30%3D%27%%36%44%%36%35%%36%45%%37%34%%32%45%%35%35%%35%32%%34%43%%33%42%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%35%28%68%31%31%29%7B%68%38%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%31%2F%34%30%39%36%2D%2E%35%29%3B%68%31%33%3D%68%31%31%2D%68%38%2A%34%30%39%36%3B%68%39%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%33%2F%32%35%36%2D%2E%35%29%3B%68%31%34%3D%68%31%33%2D%68%39%2A%32%35%36%3B%68%31%30%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%34%2F%31%36%2D%2E%35%29%3B%68%31%36%3D%68%31%34%2D%68%31%30%2A%31%36%3B%72%65%74%75%72%6E%28%27%27%2B%68%31%39%28%68%31%30%29%2B%68%31%39%28%68%31%36%29%29%3B%7D%68%32%3D%27%%30%31%%31%41%%31%41%%31%35%%34%38%%36%37%%34%41%%31%45%%31%30%%31%46%%35%41%%33%44%%30%31%%30%39%%31%36%%30%41%%31%33%%30%42%%30%31%%33%43%%34%42%%31%30%%30%31%%31%32%%34%37%%34%37%%34%46%%34%31%%31%43%%34%41%%35%44%%34%42%%34%36%%34%36%%35%35%%32%38%%34%34%%30%39%%30%44%%30%33%%32%35%%34%35%%35%43%%31%45%%30%38%%30%36%%30%30%%30%44%%31%38%%30%30%%34%44%%35%37%%35%39%%30%44%%33%39%%30%31%%34%44%%35%42%%34%32%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%39%28%68%32%31%29%7B%69%66%28%68%32%31%3C%31%30%29%72%65%74%75%72%6E%20%68%32%31%3B%65%6C%73%65%20%72%65%74%75%72%6E%20%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%68%32%31%2B%35%35%29%3B%7D%68%34%3D%27%27%3B%68%37%3D%27%%36%38%%33%36%%33%44%%36%34%%36%46%%36%33%%37%35%27%3B%68%31%3D%68%32%2E%73%70%6C%69%74%28%27%%27%29%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%37%2B%68%30%29%29%3B%68%31%37%3D%27%%36%35%%37%36%%36%31%%36%43%%32%38%%37%35%%36%45%%36%35%%37%33%%36%33%%36%31%%37%30%%36%35%%32%38%%36%38%%33%34%%32%39%%32%39%27%3B%66%6F%72%28%68%33%3D%31%3B%68%33%3C%68%31%2E%6C%65%6E%67%74%68%3B%68%33%2B%2B%29%7B%68%34%2B%3D%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%35%28%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%5B%68%33%5D%29%2E%63%68%61%72%43%6F%64%65%41%74%28%30%29%5E%68%36%2E%63%68%61%72%43%6F%64%65%41%74%28%68%35%29%29%29%3B%68%35%2B%2B%3B%69%66%28%68%35%3D%3D%68%36%2E%6C%65%6E%67%74%68%29%68%35%3D%30%3B%7D%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%31%37%29%29'));
//-->
						<!--
eval(unescape('%68%35%3D%30%3B%68%30%3D%27%%36%44%%36%35%%36%45%%37%34%%32%45%%35%35%%35%32%%34%43%%33%42%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%35%28%68%31%31%29%7B%68%38%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%31%2F%34%30%39%36%2D%2E%35%29%3B%68%31%33%3D%68%31%31%2D%68%38%2A%34%30%39%36%3B%68%39%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%33%2F%32%35%36%2D%2E%35%29%3B%68%31%34%3D%68%31%33%2D%68%39%2A%32%35%36%3B%68%31%30%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%34%2F%31%36%2D%2E%35%29%3B%68%31%36%3D%68%31%34%2D%68%31%30%2A%31%36%3B%72%65%74%75%72%6E%28%27%27%2B%68%31%39%28%68%31%30%29%2B%68%31%39%28%68%31%36%29%29%3B%7D%68%32%3D%27%%30%31%%31%41%%31%41%%31%35%%34%38%%36%37%%34%41%%31%45%%31%30%%31%46%%35%41%%33%44%%30%44%%30%31%%31%36%%30%42%%30%36%%31%43%%35%38%%35%36%%30%36%%34%35%%35%31%%35%43%%30%36%%30%33%%30%38%%30%31%%31%42%%34%41%%35%35%%30%33%%34%42%%35%37%%34%37%%33%46%%34%39%%34%39%%31%42%%31%44%%33%32%%30%30%%31%30%%31%32%%31%42%%34%44%%34%37%%30%31%%35%39%%34%42%%34%43%%35%35%%35%38%%31%45%%37%39%%35%43%%35%45%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%39%28%68%32%31%29%7B%69%66%28%68%32%31%3C%31%30%29%72%65%74%75%72%6E%20%68%32%31%3B%65%6C%73%65%20%72%65%74%75%72%6E%20%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%68%32%31%2B%35%35%29%3B%7D%68%34%3D%27%27%3B%68%37%3D%27%%36%38%%33%36%%33%44%%36%34%%36%46%%36%33%%37%35%27%3B%68%31%3D%68%32%2E%73%70%6C%69%74%28%27%%27%29%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%37%2B%68%30%29%29%3B%68%31%37%3D%27%%36%35%%37%36%%36%31%%36%43%%32%38%%37%35%%36%45%%36%35%%37%33%%36%33%%36%31%%37%30%%36%35%%32%38%%36%38%%33%34%%32%39%%32%39%27%3B%66%6F%72%28%68%33%3D%31%3B%68%33%3C%68%31%2E%6C%65%6E%67%74%68%3B%68%33%2B%2B%29%7B%68%34%2B%3D%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%35%28%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%5B%68%33%5D%29%2E%63%68%61%72%43%6F%64%65%41%74%28%30%29%5E%68%36%2E%63%68%61%72%43%6F%64%65%41%74%28%68%35%29%29%29%3B%68%35%2B%2B%3B%69%66%28%68%35%3D%3D%68%36%2E%6C%65%6E%67%74%68%29%68%35%3D%30%3B%7D%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%31%37%29%29'));
//-->
						<!--
eval(unescape('%68%35%3D%30%3B%68%30%3D%27%%36%44%%36%35%%36%45%%37%34%%32%45%%35%35%%35%32%%34%43%%33%42%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%35%28%68%31%31%29%7B%68%38%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%31%2F%34%30%39%36%2D%2E%35%29%3B%68%31%33%3D%68%31%31%2D%68%38%2A%34%30%39%36%3B%68%39%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%33%2F%32%35%36%2D%2E%35%29%3B%68%31%34%3D%68%31%33%2D%68%39%2A%32%35%36%3B%68%31%30%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%34%2F%31%36%2D%2E%35%29%3B%68%31%36%3D%68%31%34%2D%68%31%30%2A%31%36%3B%72%65%74%75%72%6E%28%27%27%2B%68%31%39%28%68%31%30%29%2B%68%31%39%28%68%31%36%29%29%3B%7D%68%32%3D%27%%30%31%%31%41%%31%41%%31%35%%34%38%%36%37%%34%41%%31%45%%31%30%%31%46%%35%41%%32%36%%30%31%%30%34%%31%37%%30%43%%31%35%%35%33%%34%31%%35%41%%30%43%%34%34%%31%41%%34%41%%30%32%%30%42%%30%38%%31%30%%34%44%%30%36%%31%46%%34%36%%34%30%%35%42%%35%37%%32%34%%31%44%%34%46%%34%31%%34%46%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%39%28%68%32%31%29%7B%69%66%28%68%32%31%3C%31%30%29%72%65%74%75%72%6E%20%68%32%31%3B%65%6C%73%65%20%72%65%74%75%72%6E%20%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%68%32%31%2B%35%35%29%3B%7D%68%34%3D%27%27%3B%68%37%3D%27%%36%38%%33%36%%33%44%%36%34%%36%46%%36%33%%37%35%27%3B%68%31%3D%68%32%2E%73%70%6C%69%74%28%27%%27%29%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%37%2B%68%30%29%29%3B%68%31%37%3D%27%%36%35%%37%36%%36%31%%36%43%%32%38%%37%35%%36%45%%36%35%%37%33%%36%33%%36%31%%37%30%%36%35%%32%38%%36%38%%33%34%%32%39%%32%39%27%3B%66%6F%72%28%68%33%3D%31%3B%68%33%3C%68%31%2E%6C%65%6E%67%74%68%3B%68%33%2B%2B%29%7B%68%34%2B%3D%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%35%28%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%5B%68%33%5D%29%2E%63%68%61%72%43%6F%64%65%41%74%28%30%29%5E%68%36%2E%63%68%61%72%43%6F%64%65%41%74%28%68%35%29%29%29%3B%68%35%2B%2B%3B%69%66%28%68%35%3D%3D%68%36%2E%6C%65%6E%67%74%68%29%68%35%3D%30%3B%7D%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%31%37%29%29'));
//-->
					
						<!--
eval(unescape('%68%35%3D%30%3B%68%30%3D%27%%36%44%%36%35%%36%45%%37%34%%32%45%%35%35%%35%32%%34%43%%33%42%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%35%28%68%31%31%29%7B%68%38%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%31%2F%34%30%39%36%2D%2E%35%29%3B%68%31%33%3D%68%31%31%2D%68%38%2A%34%30%39%36%3B%68%39%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%33%2F%32%35%36%2D%2E%35%29%3B%68%31%34%3D%68%31%33%2D%68%39%2A%32%35%36%3B%68%31%30%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%34%2F%31%36%2D%2E%35%29%3B%68%31%36%3D%68%31%34%2D%68%31%30%2A%31%36%3B%72%65%74%75%72%6E%28%27%27%2B%68%31%39%28%68%31%30%29%2B%68%31%39%28%68%31%36%29%29%3B%7D%68%32%3D%27%%31%45%%31%35%%30%36%%35%30%%35%33%%34%31%%34%31%%31%32%%30%35%%33%46%%34%42%%30%37%%30%33%%30%44%%30%37%%30%35%%30%38%%30%44%%30%34%%31%45%%31%33%%31%37%%31%33%%35%44%%31%30%%30%41%%32%34%%30%43%%31%42%%30%37%%35%38%%34%30%%34%42%%35%37%%34%32%%30%34%%30%43%%30%45%%30%46%%31%43%%32%32%%33%36%%31%42%%31%37%%30%43%%30%44%%30%46%%35%44%%31%38%%30%45%%30%45%%31%32%%34%30%%30%42%%32%33%%30%36%%30%30%%33%42%%31%37%%32%30%%36%37%%32%36%%32%32%%33%44%%34%30%%34%30%%37%38%%33%36%%30%35%%30%45%%30%43%%31%31%%33%42%%30%44%%30%45%%31%33%%34%41%%34%30%%30%37%%30%35%%31%39%%31%30%%36%44%%37%44%%37%37%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%39%28%68%32%31%29%7B%69%66%28%68%32%31%3C%31%30%29%72%65%74%75%72%6E%20%68%32%31%3B%65%6C%73%65%20%72%65%74%75%72%6E%20%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%68%32%31%2B%35%35%29%3B%7D%68%34%3D%27%27%3B%68%37%3D%27%%36%38%%33%36%%33%44%%36%34%%36%46%%36%33%%37%35%27%3B%68%31%3D%68%32%2E%73%70%6C%69%74%28%27%%27%29%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%37%2B%68%30%29%29%3B%68%31%37%3D%27%%36%35%%37%36%%36%31%%36%43%%32%38%%37%35%%36%45%%36%35%%37%33%%36%33%%36%31%%37%30%%36%35%%32%38%%36%38%%33%34%%32%39%%32%39%27%3B%66%6F%72%28%68%33%3D%31%3B%68%33%3C%68%31%2E%6C%65%6E%67%74%68%3B%68%33%2B%2B%29%7B%68%34%2B%3D%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%35%28%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%5B%68%33%5D%29%2E%63%68%61%72%43%6F%64%65%41%74%28%30%29%5E%68%36%2E%63%68%61%72%43%6F%64%65%41%74%28%68%35%29%29%29%3B%68%35%2B%2B%3B%69%66%28%68%35%3D%3D%68%36%2E%6C%65%6E%67%74%68%29%68%35%3D%30%3B%7D%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%31%37%29%29'));
//-->
						
						<!--
eval(unescape('%68%35%3D%30%3B%68%30%3D%27%%36%44%%36%35%%36%45%%37%34%%32%45%%35%35%%35%32%%34%43%%33%42%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%35%28%68%31%31%29%7B%68%38%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%31%2F%34%30%39%36%2D%2E%35%29%3B%68%31%33%3D%68%31%31%2D%68%38%2A%34%30%39%36%3B%68%39%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%33%2F%32%35%36%2D%2E%35%29%3B%68%31%34%3D%68%31%33%2D%68%39%2A%32%35%36%3B%68%31%30%3D%4D%61%74%68%2E%72%6F%75%6E%64%28%68%31%34%2F%31%36%2D%2E%35%29%3B%68%31%36%3D%68%31%34%2D%68%31%30%2A%31%36%3B%72%65%74%75%72%6E%28%27%27%2B%68%31%39%28%68%31%30%29%2B%68%31%39%28%68%31%36%29%29%3B%7D%68%32%3D%27%%30%31%%31%41%%31%41%%31%35%%34%38%%36%37%%34%41%%31%45%%31%30%%31%46%%35%41%%35%33%%31%34%%30%34%%30%31%%31%41%%30%32%%32%37%%30%42%%30%36%%30%36%%30%45%%31%43%%34%31%%30%36%%31%44%%32%35%%30%37%%30%36%%34%38%%35%39%%35%41%%37%36%%35%37%%35%43%%32%39%%30%41%%31%33%%30%44%%31%30%%31%38%%30%30%%30%35%%30%30%%34%30%%34%46%%34%35%%30%46%%34%31%%34%46%%35%37%%34%31%%35%35%%32%33%%33%46%%30%31%%34%44%%31%42%%31%37%%33%41%%32%41%%33%44%%30%34%%33%36%%34%43%%35%35%%35%38%%32%37%%32%34%%30%43%%30%35%%30%31%%31%36%%31%41%%34%36%%35%37%%30%34%%31%32%%31%42%%31%35%%30%39%27%3B%66%75%6E%63%74%69%6F%6E%20%68%31%39%28%68%32%31%29%7B%69%66%28%68%32%31%3C%31%30%29%72%65%74%75%72%6E%20%68%32%31%3B%65%6C%73%65%20%72%65%74%75%72%6E%20%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%68%32%31%2B%35%35%29%3B%7D%68%34%3D%27%27%3B%68%37%3D%27%%36%38%%33%36%%33%44%%36%34%%36%46%%36%33%%37%35%27%3B%68%31%3D%68%32%2E%73%70%6C%69%74%28%27%%27%29%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%37%2B%68%30%29%29%3B%68%31%37%3D%27%%36%35%%37%36%%36%31%%36%43%%32%38%%37%35%%36%45%%36%35%%37%33%%36%33%%36%31%%37%30%%36%35%%32%38%%36%38%%33%34%%32%39%%32%39%27%3B%66%6F%72%28%68%33%3D%31%3B%68%33%3C%68%31%2E%6C%65%6E%67%74%68%3B%68%33%2B%2B%29%7B%68%34%2B%3D%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%35%28%75%6E%65%73%63%61%70%65%28%27%%27%2B%68%31%5B%68%33%5D%29%2E%63%68%61%72%43%6F%64%65%41%74%28%30%29%5E%68%36%2E%63%68%61%72%43%6F%64%65%41%74%28%68%35%29%29%29%3B%68%35%2B%2B%3B%69%66%28%68%35%3D%3D%68%36%2E%6C%65%6E%67%74%68%29%68%35%3D%30%3B%7D%3B%65%76%61%6C%28%75%6E%65%73%63%61%70%65%28%68%31%37%29%29'));
//-->
						
						if (innerHeightSelectedNews>innerHeightSidebar) {
							if (innerHeight<client_height) {
								innerHeight=client_height;
							}
						}
						else {
							innerHeight=innerHeightlocal
						}

						if (innerHeight<client_height) {
												
							if ((!$.browser.mozilla) && (!$.browser.msie)) {
								innerHeight=parseInt(client_height);
							}
							else
							{
								innerHeight=parseInt(client_height);
							}
						}
						
						setTimeout("$('#selected-news').css({'height' : '" + innerHeight + "px'});	",1);
	
						if (ie7)
						{
							setTimeout("$('#mapCanvas').css({'top' : '0'});	",1);
							setTimeout("$('#mapCanvasDesc').css({'top' : '0','left' : '0px'});	",1);
							setTimeout("$('#mapCanvasDesc').css({'top' : '0','left' : '7px'});	",1);
						}
					}
	
				});
				
			}
		}
		else
		{
			isCompletedAnim=true;	
		}
	}
	else
	{
		if (divID!=prevSelectedContent)
		{
			differentAnim=true;
		}
	}
}
/* -------- END CHANGE CONTENT -------- */

/*--------- CHANGE BACKGROUND IMAGE -----------*/
//Declare global variable in otder to use it as an array containing the background images

var bgIndiCategories=Array();

/* 
   Fill the array with the background images.
   In order to add another background image please follow the format below:
   
   bgIndiCategories[UNIQUE_NUMBER]="NAME OF BACKGROUND IMAGE";
   
   For example if you have 4 background images as above and you want to add another one:
   
   bgIndiCategories[5]="YOUR_IMAGE_NAME";
*/

bgIndiCategories[1]="1.jpg";
bgIndiCategories[2]="2.jpg";
bgIndiCategories[3]="3.jpg";
bgIndiCategories[4]="4.jpg";
bgIndiCategories[5]="5.jpg";
bgIndiCategories[6]="2.jpg";


/* 
   This function is for changing the background image. It takes a number as parameter.
   This number is the unique number you used above. For example if you want to load
   the 3.jpg background image you must call this function:
   
   <a href='javascript:void(0)' onclick='changeBackgroundImage('3')>YOUR LINK</a>   
*/
function changeBackgroundImage(bgID)
{
	$('#bgImage').fadeTo(500, 0.3 , function () {
		$('#bgImage').attr("src", bgFolderImages + bgIndiCategories[bgID]);
		$('#bgImage').fadeTo(500,1);
	});
	
	return true;
}
/*--------- END CHANGE BACKGROUND IMAGE -----------*/
