/*
// IA Vacations
// Global Site Functions
// Mindlock Innovations
// Dec. 22 2010 8:51am
*/


// Get browser
if($.browser.msie) var isIE=1;


// OnReady calls

$(document).ready(function(){
    // Define Base
    var baseUrl = $('#baseUrl').attr('name');
	// hide all rotateItems
	$('.rotateItem').hide();
	// Show first on page load
	$('.rotateItem:first').show().addClass('activeR');
	var firstContent = $('.rotateItem:first').children('p').html();
	// Start Rotate
    $('#rotateContent').html(firstContent);
	fX = setInterval("bannerRotate()", 7000);

    // logo click
    $('#top_logo').click(function(){ location.href = baseUrl; });
    // homeBox Click
    $('.homeBox, .homeh3').click(function(){ location.href = baseUrl+'/Free-Sell-My-TimeShare-Quote'; });
    $('.homeBox, .homeh3').css('cursor', 'pointer')

    /* 
	// FAQ Sections 
	// Used in partials "any"FAQ.phtml
	// Mindlock Innovations
	// Mar. 31 2011 10:25pm
	*/

	$(".question").click(function(){
        $(".answer").hide();
        $(this).children('.answer').fadeIn(1500);
	});
	$(".answer").hide(); $(".first").show();
	$(".hideall").click(function(){ $(".answer").hide(); });
	
});

/* 
// Copyright Year
// get current year for copy right 
// Mindlock Innovations
// Jan. 8 2011 8:42pm
*/

function copyrightYear() {
    return new Date().getFullYear();
}



/* 
// Banner Rotate
// elms: div#banner > div#rotateWrap > div#rotate
// Innerelms: div#rotateItem > p > span 
// Mindlock Innovations
// Dec. 22 2010 8:54am
*/


function bannerRotate(){
    // find first/next | Check if last | animate 
    var firstR = $('.rotateItem:first');
	var nextR = $('.activeR').next('.rotateItem');
	if($(nextR).hasClass('lastR')) nextR = $('.rotateItem:first');
    // get contents of next rotate
	var Rcontent = $(nextR).children('p').html();
    $('.activeR').removeClass('activeR').css('z-index', '10').fadeOut(500);
    $(nextR).addClass('activeR').css('z-index', '20').fadeIn(3500);
    $('#rotateContent').html(Rcontent);
}


/* 
// Round Me 
// tested in:
// OSX: OP8, FF3, SF5
// WIN: IE7 IE8  
// Mindlock Innovations
// Dec. 22 2010 3:45pm
*/

function roundMe(elm, TH, TL, TR, BL, BR){
    var baseUrl = $('#baseUrl').attr('name');
    if(!TR){ TR=TL; BL=TL; BR=TL; }
        $(elm).css({
        'position' : 'relative',
        'border-style' : 'solid',
        'border-width' : TH,
        '-moz-border-radius' : ''+TL+'px '+TR+'px '+BR+'px '+BL+'px',
        '-webkit-border-radius' : ''+TL+'px '+TR+'px '+BR+'px '+BL+'px',
        'border-radius' : ''+TL+'px '+TR+'px '+BR+'px '+BL+'px',
        'padding-top' : (TL+TR/2)/4,
        'padding-bottom' : (BL+BR/2)/4,
        'padding-left' : (TL+BL/2)/4,
        'padding-right' : (TR+BR/2)/4,
        'behavior' : 'url('+baseUrl+'/js/PIE.htc)'
        });
}




