//////////////////////////////////////////////////////////////////////////////////////////////////////
//CUFON
//////////////////////////////////////////////////////////////////////////////////////////////////////

//	Cufon.replace('h2 span, #menu ul li a', {fontFamily: 'ACaslonPro-Regular', hover: true});
	
//	Cufon.replace('h2 strong, .content-left h3, .content-wide h2, #header .tag-lines span, #content .taglines-pic span, #contact-form label', {fontFamily: 'ApexNew-Medium', hover: true});


//////////////////////////////////////////////////////////////////////////////////////////////////////
//IMG BUB
//////////////////////////////////////////////////////////////////////////////////////////////////////

jQuery(document).ready(function($){
	$('ul#orbs').imgbubbles({factor:1.35,speed:200})
})


//////////////////////////////////////////////////////////////////////////////////////////////////////
//BUTTON
//////////////////////////////////////////////////////////////////////////////////////////////////////

//$(document).ready(function(){
//$('.btn').each(function(){
//var b = $(this);
//var tt = b.text() || b.val();
//if ($(':submit,:button',this)) {
//b = $('<a>').insertAfter(this). addClass(this.className).attr('id',this.id);
//$(this).remove();
//}
//b.text('').css({cursor:'pointer'}). prepend('<i></i>').append($('<span>').
//text(tt).append('<i></i><span></span>'));
//});
//});


//////////////////////////////////////////////////////////////////////////////////////////////////////
//DATE PICKER
//////////////////////////////////////////////////////////////////////////////////////////////////////

//	$(function() {
//		$( "#datepicker" ).datepicker({
//			numberOfMonths: 2,
//                                    altField: '#dep_month',  
//                                     altFormat: 'mm', 
//                                     onClose: function(dateText,picker) { 
//                                                 $('#dep_day').val( dateText.split(/\//)[1] );
//                                                 $('#dep_year').val( dateText.split(/\//)[2] );
//                                              },

//			showOn: "button",
//			buttonImage: "/cm/admin/images/calshow.png",
//			buttonImageOnly: true
//		});
//	});

	
//////////////////////////////////////////////////////////////////////////////////////////////////////
//TABS
//////////////////////////////////////////////////////////////////////////////////////////////////////

$(document).ready(function() {

	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

});



//////////////////////////////////////////////////////////////////////////////////////////////////////
//FAQ
//////////////////////////////////////////////////////////////////////////////////////////////////////

$(document).ready(function() {
$('#question_0').click(function(){$.scrollTo('#answer_0', {duration: 500, onAfter:function(){$('#answer_0_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_1').click(function(){$.scrollTo('#answer_1', {duration: 500, onAfter:function(){$('#answer_1_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_2').click(function(){$.scrollTo('#answer_2', {duration: 500, onAfter:function(){$('#answer_2_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_3').click(function(){$.scrollTo('#answer_3', {duration: 500, onAfter:function(){$('#answer_3_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_4').click(function(){$.scrollTo('#answer_4', {duration: 500, onAfter:function(){$('#answer_4_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_5').click(function(){$.scrollTo('#answer_5', {duration: 500, onAfter:function(){$('#answer_5_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_6').click(function(){$.scrollTo('#answer_6', {duration: 500, onAfter:function(){$('#answer_6_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_7').click(function(){$.scrollTo('#answer_7', {duration: 500, onAfter:function(){$('#answer_7_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_8').click(function(){$.scrollTo('#answer_8', {duration: 500, onAfter:function(){$('#answer_8_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_9').click(function(){$.scrollTo('#answer_9', {duration: 500, onAfter:function(){$('#answer_9_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_10').click(function(){$.scrollTo('#answer_10', {duration: 500, onAfter:function(){$('#answer_10_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_11').click(function(){$.scrollTo('#answer_11', {duration: 500, onAfter:function(){$('#answer_11_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_12').click(function(){$.scrollTo('#answer_12', {duration: 500, onAfter:function(){$('#answer_12_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_13').click(function(){$.scrollTo('#answer_13', {duration: 500, onAfter:function(){$('#answer_13_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_14').click(function(){$.scrollTo('#answer_14', {duration: 500, onAfter:function(){$('#answer_14_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});

$('#question_15').click(function(){$.scrollTo('#answer_15', {duration: 500, onAfter:function(){$('#answer_15_text').highlightFade({color:'rgb(225, 251, 253)', speed: 1500});} });});


// Go To TOP
$('.go_to_top').click(function(){
$.scrollTo('#top_zone', {duration: 500});
});

});


//////////////////////////////////////////////////////////////////////////////////////////////////////
//SLIDER & TAB
//////////////////////////////////////////////////////////////////////////////////////////////////////

var myWidth;
var myHeight;

if( typeof( window.innerWidth ) == 'number' ) { 

//Non-IE 

myWidth = window.innerWidth;
myHeight = window.innerHeight; 

} else if( document.documentElement && 

( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { 

//IE 6+ in 'standards compliant mode' 

myWidth = document.documentElement.clientWidth; 
myHeight = document.documentElement.clientHeight; 

} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { 

//IE 4 compatible 

myWidth = document.body.clientWidth; 
myHeight = document.body.clientHeight; 

} 

//document.getElementById("map").style.height = myHeight+'px';
//document.getElementById("map").style.width = myWidth+'px';

var slidespeed=400;
var slidepos=0;
//if (document.getElementById('tabpos')) {if (document.getElementById('tabpos').value == '1') {slidespeed=1;slidepos=1;}}

if (myHeight < 770) {
$(function(){
        $('#slide-out-div').tabSlideOut({
            tabHandle: '.handle',                     //class of the element that will become your tab
            tabLocation: 'left',                      //side of screen where tab lives, top, right, bottom, or left
            speed: slidespeed,                               //speed of animation
            action: 'click',                          //options: 'click' or 'hover', action to trigger animation
            topPos: '0px',                          //position from the top/ use if tabLocation is left or right
            leftPos: '33.3%',                          //position from left/ use if tabLocation is bottom or top
            fixedPosition: false,                      //options: true makes it stick(fixed position) on scroll
			onLoadSlideOut: slidepos
        });

    });
} else {
$(function(){
        $('#slide-out-div').tabSlideOut({
            tabHandle: '.handle',                     //class of the element that will become your tab
            tabLocation: 'left',                      //side of screen where tab lives, top, right, bottom, or left
            speed: slidespeed,                               //speed of animation
            action: 'click',                          //options: 'click' or 'hover', action to trigger animation
            topPos: '0px',                          //position from the top/ use if tabLocation is left or right
            leftPos: '33.3%',                          //position from left/ use if tabLocation is bottom or top
            fixedPosition: true,                      //options: true makes it stick(fixed position) on scroll
			onLoadSlideOut: slidepos
        });

    });
}

$(document).ready(function() {

    $('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });

 $('#slider') 

.after('<div id="buller-img"></div>') 

.cycle({ 

    fx:     'fade', 

    speed: 1200, 

    timeout: 4000, 

    pager:  '#buller-img' 

});



var position=1;

 $('#buller-img a').each(function(i){

             

   $(this).addClass("pos_"+position);

    position=(position*1) + (1*1)

});



});



$('#buller-img a').click(function() {

 

 var position=1;

 $('#buller-img a').each(function(i){

             

  $(this).removeClass('active_'+position);



    position=(position*1) + (1*1)

});



$('#buller-img a').addClass('active_'+position)

});

//////////////////////////////////////////////////////////////////////////////////////////////////////
//CUSTOM FORM ELEMENTS
//////////////////////////////////////////////////////////////////////////////////////////////////////

function mainmenu(){

$(" #myajaxmenu li ").hover(function(){
	$(this).find('ul:first:hidden').css({visibility: "visible",display: "none"}).slideDown(10);
	
              $(this).find('a:first').addClass('hover');

	},function(){
		$(this).find('ul:first').slideUp(10);
		$(this).find('a:first').removeClass('hover');
	});


}
