// ------------------------
// Basic Javascript effects by Ringo Bautista
// ------------------------

var swap_text_boxes = [];

function init_swap_text_boxes(){
	//Store the default value for each box
	$('input[type=text][value].swaptextbox').each(function() {
		swap_text_boxes[$(this).attr('id')] = $(this).attr('value');
	});
	//Add focus and blur events to set or clear the value
	$('input[type=text][value].swaptextbox').bind('focus', function() {
		if($(this).val() == swap_text_boxes[$(this).attr('id')]) {
			$(this).val('');
		}
	});
	$('input[type=text][value].swaptextbox').bind('blur', function() {
		if($(this).val() == '') {
			$(this).val(swap_text_boxes[$(this).attr('id')]);
		}
	});
}

$(document).ready(function(){ init_swap_text_boxes(); });


// :hover pseudoclass fix on ie - ringo

$(document).ready(function(){
	$('li.headlink').hover(
	function() { $('ul', this).css('display', 'block'); },
	function() { $('ul', this).css('display', 'none'); });
});

// dropdown implementation

$(document).ready(function() {
	$('ul.main-nav').superfish({
		delay:       500,                            // one second delay on mouseout
		animation:   {height:'show'},  // fade-in and slide-down animation
		speed:       'medium',                          // faster animation speed
		autoArrows: true,                           // disable generation of arrow mark-up
		dropShadows: true                            // disable drop shadows
	});
});


// news slide

$(document).ready(function(){

	/*news items slides  horizontally on the homepage*/
	$("#news-slides").wslide({
		width: 250,
		height: 40,
		pos: 1,
		horiz: true
	});
	/* image version of the news-slides above*/
	$("#image-slides").wslide({
		width: 400,
		height: 250,
		autolink: false,
		fade: true,
		duration: 2000
	});
});


// loader

/*
$(document).ready(function(){

	$('#preloaded_content').hide();

});

function showContent(){
	$('#preloaded_content').show();
	$('#loading').hide();
}
*/

//loader fix

function showContent(){
	$('#preloaded_content').show().css('visibility','visible');
	$('#loading-home').hide();
}


// jump to transition

function swapDiv(SelectID)
{
	var jumper=document.getElementById(SelectID).selectedIndex;
	var optionvalue = document.getElementById(SelectID)[jumper].value;

	if (optionvalue!=""){
		$('#world-map').hide();
		$('#abu').hide();
		$('#bal').hide();
		$('#bar').hide();
		$('#cyp').hide();
		$('#uae').hide();
		$('#dub').hide();
		$('#aus').hide();
		$('#cyp').hide();
		$('#gre').hide();
		$('#ind').hide();
		$('#kuw').hide();
		$('#oma').hide();
		$('#phi').hide();
		$('#rom').hide();
		$('#rus').hide();
		$('#sau').hide();
		$('#saf').hide();
		$('#thi').hide();
		$(document.getElementById(optionvalue)).show();		
	}else
	{
		$('#world-map').show();
	}
	
}

