// JavaScript Document
function changeCurrency(show) {
	visi("currency_au","off");
	visi("currency_nz","off");
	visi("currency_us","off");
	visi("currency_uk","off");
	visi("currency_eu","off");
	visi(show,"on");
	changeCharges("");
}

function changeCharges(show) {
	visi("charges_au","off");
	visi("charges_nz","off");
	visi("charges_us","off");
	visi("charges_uk","off");
	visi("charges_eu","off");
	
	if ( show == "charges_au" || show == "charges_nz" || show == "charges_us" || show == "charges_uk" || show == "charges_eu" )
		visi(show,"on");
}

function visi(item,flag)
	{
		if (document.layers)
			{
				// Other
				if ( flag == 'on' )
					document.layers[item].display = 'block';
				else	
					document.layers[item].display = 'none';
			}
		else if (document.all)
			{
				// IE
				if ( flag == 'on' )
					document.all[item].style.display = 'block';
				else	
					document.all[item].style.display = 'none';
			}
		else if (document.getElementById)
			{
				// Firefox
				if ( flag == 'on' )
					document.getElementById(item).style.display = 'block';
				else	
					document.getElementById(item).style.display = 'none';
			}
//		alert(item);	
	}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

	function showTestimonial() {
			$('body').append('<div id="fadeTestimonials"></div>'); //Add the fade layer to bottom of the body tag.
			$('#fadeTestimonials').css({'filter' : 'alpha(opacity=60)'}).fadeIn(); // fix the IE Bug on fading transparencies 
	
			var offsetString = getNewPosition(".wrapper","#TestimonialPage");
			$('#TestimonialPage').animate({left:offsetString});
			$('#TestimonialPage').fadeIn();
			$('#ajaxContentTestimonial').load('php/ajax_get_testimonials.php',{className:'.ajaxContentTestimonial'});
	};
	
	function hideTestimonial() {
		$('#TestimonialPage').fadeOut();
		$('#fadeTestimonials').fadeOut(function(){
			$('#fadeTestimonials').remove();});
	}


$(document).ready(function(){

// testimonial related script
	$(function() {
		$("#TestimonialPage").draggable({ handle: "#TestimonialHandle" });
	});
	
	$("#TestimonialHandle").live("mouseenter",function(){
	document.body.style.cursor = 'move';
	});
	
	$("#TestimonialHandle").live("mouseleave",function(){
	document.body.style.cursor = 'default';
	});          	
	
	$("#fadeTestimonials").live('click',function(){
		$("#TestimonialPage").fadeOut("normal");
		$('#fadeTestimonials').fadeOut(function(){
			$('#fadeTestimonials').remove();});
	});

// pricing related script
  $("#sysPricing").click(function(){
	  if ( $('#popupPricing').css('display') == 'none' )
	  	{
        	$('body').append('<div id="fadePricing"></div>'); //Add the fade layer to bottom of the body tag.
    		$('#fadePricing').css({'filter' : 'alpha(opacity=60)'}).fadeIn(); // fix the IE Bug on fading transparencies 

				var offsetString = getNewPosition(".wrapper","#popupPricing");
				$("#popupPricing").animate({left:offsetString});
	  		$("#popupPricing").fadeIn();
		}
	  else	
	    $("#popupPricing").fadeOut();
	});
	
	$("#sysPricingButton").click(function(){
	  if ( $('#popupPricing').css('display') == 'none' )
	  	{
        	$('body').append('<div id="fadePricing"></div>'); //Add the fade layer to bottom of the body tag.
    		$('#fadePricing').css({'filter' : 'alpha(opacity=60)'}).fadeIn(); // fix the IE Bug on fading transparencies 

				var offsetString = getNewPosition(".wrapper","#popupPricing");
				$("#popupPricing").animate({left:offsetString});
	  		$("#popupPricing").fadeIn();
		}
	  else	
	    $("#popupPricing").fadeOut();
	});
	
	$("#closePricing").live("click",function(){
	  $("#popupPricing").fadeOut("normal");
    
	  $('#fadePricing').fadeOut(function(){
		$('#fadePricing').remove();});
  	});
	
	$(function() {
		$("#popupPricing").draggable({ handle: ".topBar" });
	});
	
	$(".topBar").live("mouseenter",function(){
		document.body.style.cursor = 'move';											  
	});

	$(".topBar").live("mouseleave",function(){
		document.body.style.cursor = 'default';											  
	});

	$(function() {
		$( "#tabs" ).tabs();
	});
	
	$("#lbOne").mouseenter(function(){
	  $("#lbOne").animate({height:104},150);
	});
	
	$("#lbOne").mouseleave(function(){
	  $("#lbOne").stop(true,true).css({height:18});
	});
	
	$("#lbTwo").mouseenter(function(){
	  $("#lbTwo").animate({height:104},150);
	});
	
	$("#lbTwo").mouseleave(function(){
	  $("#lbTwo").stop(true,true).css({height:18});
	});
	
	$("#lbThree").mouseenter(function(){
	  $("#lbThree").animate({height:104},150);
	});
	
	$("#lbThree").mouseleave(function(){
	  $("#lbThree").stop(true,true).css({height:18});
	});
	
	$("#lbFour").mouseenter(function(){
	  $("#lbFour").animate({height:104},150);
	});
	
	$("#lbFour").mouseleave(function(){
	  $("#lbFour").stop(true,true).css({height:18});
	});
	
	$("#lbFive").mouseenter(function(){
	  $("#lbFive").animate({height:90},150);
	});
	
	$("#lbFive").mouseleave(function(){
	  $("#lbFive").stop(true,true).css({height:18});
	});
	
	$("#lbSix").mouseenter(function(){
	  $("#lbSix").animate({height:18},150);
	});
	
	$("#lbSix").mouseleave(function(){
	  $("#lbSix").stop(true,true).css({height:18});
	});
	
	$("#lbSeven").mouseenter(function(){
	  $("#lbSix").animate({height:18},150);
	});
	
	$("#lbSeven").mouseleave(function(){
	  $("#lbSeven").stop(true,true).css({height:18});
	});
	
	$("#openIA").click(function(){
	  if ( $("#ObjQuestionsPage").css("display") == 'none' )
	  	{
			$("#ajaxContentObjQuestions").html("<div style='text-align:center; margin-top:160px;'><img src='images/load_animation.gif' width='196' height='20' alt='load image' /></div>");
        	$('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
    		$('#fade').css({'filter' : 'alpha(opacity=60)'}).fadeIn(); //Fade in the fade layer - .css({'filter' : 'alpha(opacity=80)'}) is used to fix the IE Bug on fading transparencies 

	  	  $.ajax({cache:false});
				var offsetString = getNewPosition(".wrapper","#ObjQuestionsPage");
				$("#ObjQuestionsPage").animate({top:160,left:offsetString});
	  	  $("#ObjQuestionsPage").fadeIn();
  		  $("#ajaxContentObjQuestions").load("interview_assist.html",{action:'thisOne'});
  		}
	  else
	  	$("#ObjQuestionsPage").fadeOut();
	});
	
	$("#openIAButton").click(function(){
	  if ( $("#ObjQuestionsPage").css("display") == 'none' )
	  	{
				$("#ajaxContentObjQuestions").html("<div style='text-align:center; margin-top:160px;'><img src='images/load_animation.gif' width='196' height='20' alt='load image' /></div>");
        	$('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
    		$('#fade').css({'filter' : 'alpha(opacity=60)'}).fadeIn(); //Fade in the fade layer - .css({'filter' : 'alpha(opacity=80)'}) is used to fix the IE Bug on fading transparencies 

	  	  $.ajax({cache:false});
				var offsetString = getNewPosition(".wrapper","#ObjQuestionsPage");
				$("#ObjQuestionsPage").animate({top:160,left:offsetString});
	  	  $("#ObjQuestionsPage").fadeIn();
  		  $("#ajaxContentObjQuestions").load("interview_assist.html",{action:'thisOne'});
  		}
	  else
	  	$("#ObjQuestionsPage").fadeOut();
	});

/*	// This function is on the interview_assist.html file
	function openGQ(){
		  $("#ajaxContentObjQuestions").load("php/ajax_objective_questions_homepage.php",{action:'thisOne'});
	}
*/	

	$("#closeOQ").live('click',function(){
		$("#ObjQuestionsPage").fadeOut().animate({height:350});
		$('#fade').fadeOut(function(){
			$('#fade').remove();});
	});
	
	$("#fade").live('click',function(){
		$("#ObjQuestionsPage").fadeOut().animate({height:350});
		$('#fade').fadeOut(function(){
			$('#fade').remove();});
	});
	
	$("#fadePricing").live('click',function(){
		$("#popupPricing").fadeOut("normal");
		$('#fadePricing').fadeOut(function(){
			$('#fadePricing').remove();});
	});
	
	$( "#ObjQuestionsPage" ).draggable({ handle: "#ObjQuestionsHandle" });
	
	$("#ObjQuestionsHandle").mouseenter(function(){
		document.body.style.cursor = 'move';											  
	});

	$("#ObjQuestionsHandle").mouseleave(function(){
		document.body.style.cursor = 'default';											  
	});

	$('.newsContent').vScroll({ 
		speed: 500, 
		height: 170, 
		upID: "#newsUp", 
		downID: "#newsDown", 
		cycle: true 
	});	

	$("#newsDown").mouseenter(function(){
		document.body.style.cursor = 'pointer';											  
	});

	$("#newsDown").mouseleave(function(){
		document.body.style.cursor = 'default';											  
	});

	$("#newsUp").mouseenter(function(){
		document.body.style.cursor = 'pointer';											  
	});

	$("#newsUp").mouseleave(function(){
		document.body.style.cursor = 'default';											  
	});

	/******************* Region Code ************************/

	$("#locationOption").mouseenter(function(){
		$(".locationSlide").fadeIn();											  
	});

	$("#locationOption").mouseleave(function(){
		$(".locationSlide").clearQueue();
		$(".locationSlide").delay(500).fadeOut();											  
	});

	$(".locationSlide").mouseenter(function(){
		$(".locationSlide").clearQueue();
		$(".locationSlide").show();											  
	});

	$(".locationSlide").mouseleave(function(){
		$(".locationSlide").fadeOut();											  
	});

	$("#browserOption").mouseover(function(){
		$("#browserOptionInfo").fadeIn();
 });

	$("#browserOption").mouseout(function(){
		$("#browserOptionInfo").fadeOut();
 });

});

function getNewPosition(wrapperName,divName)
{
	var wrapperPos = $(wrapperName).position();
	var wrapperXPosInt = wrapperPos.left;
	// showing divName and hiding it is required for Firefox
	$(divName).show();
	var cssLeft = $(divName).css('left');
	$(divName).hide();
	var cssLeftInt = parseInt(cssLeft.substr(0,cssLeft.indexOf("px")));
	var offset = (cssLeftInt + wrapperXPosInt);
	var offsetString = offset + "px";
	
	return offsetString;
}

function processForm()
{
	$(".form").html("<div style='padding-top:70px; width:100%; text-align:center;'>Thank you for submitting this form.</div>");
	return false;
}

