/*<![CDATA[*/
function ShowOne(cls){
 var ds=zxcByClassName(cls);
 var rnu=Math.floor(Math.random()*ds.length);
 for (var z0=0;z0<ds.length;z0++){
  ds[z0].style.display=z0!=rnu?'none':'block';
 }
}

function zxcByClassName(nme,el,tag){
 if (typeof(el)=='string') el=document.getElementById(el);
 el=el||document;
 for (var tag=tag||'*',reg=new RegExp('\\b'+nme+'\\b'),els=el.getElementsByTagName(tag),ary=[],z0=0; z0<els.length;z0++){
  if(reg.test(els[z0].className)) ary.push(els[z0]);
 }
 return ary;
}

/*]]>*/

Cufon.replace('#mainNav li.current a', { hover:true, fontFamily: 'Alright Medium', color: '#ed7c17'});
Cufon.replace('.secondaryNav li.current a', { hover: true, fontFamily: 'Alright Sans', color: '#ed7c17'});
Cufon.replace('h1', { fontFamily: 'Alright Medium', textShadow: '1px 1px #909090'});
Cufon.replace('#homeSlide3 h1', { fontFamily: 'Alright Medium', textShadow: '1px 1px #fff'});
Cufon.replace('div.topButtons, #mainNav li a, div.homeGray p, a.homeMore2, #homeSlide4 h1', { hover: true, fontFamily: 'Alright Medium'});
Cufon.replace('a.homeMore3', { hover: true, fontFamily: 'Alright Medium', textShadow: '1px 1px #fff'});
Cufon.replace('a.homeMore, ul.checkWhite', { hover:true, fontFamily: 'Alright Medium', textShadow: '-1px -1px #c25c19'});
//Cufon.replace('.secondaryNav li', { hover:true, fontFamily: 'Alright Sans'}); 
Cufon.replace('#questions', { hover:true, fontFamily: 'Alright Sans', textShadow: '1px 1px #ffc984'});
Cufon.replace('#login label', { hover:true, fontFamily: 'Alright Medium', textShadow: '-1px -1px #cb762c'});	
Cufon.replace('h3, #footerAd, #footer p.floatleft, div#emailLink p, div.overview p', { fontFamily: 'Alright Sans'}); 	
Cufon.replace('ul.libraryHeader li, h2, p.upperOrange, strong, p.centeredH, li.title, li.title2, p.more a, #testimonials h4, .gray p, h3.bold', { hover:true, fontFamily: 'Alright Bold'});
Cufon.replace('li.title span.thin', { fontFamily: 'Alright Sans', color: 'black'});
Cufon.replace('#homeSlide2 h2, #homeSlide3 h2, #homeSlide4 h2', { fontFamily: 'Alright Sans'}); 
Cufon.replace('#homeSlide2 h1', { fontFamily: 'Alright Medium', textShadow: '-1px -1px black'}); 
Cufon.replace('#homeSlide3 h2 span, .modal_head h4', { hover:true, fontFamily: 'Alright Bold'});
Cufon.replace('p.featureBlurb', { fontFamily: 'Alright Light'});
Cufon.replace('#logo h1', { fontFamily: 'Alright Sans', textShadow: '1px 1px #ffe2c8' });
Cufon.replace('#homeFooter span.trademark', { fontFamily: 'Alright Medium', textShadow: '1px 1px #ffc984'});
Cufon.replace('#homeFooter strong', { fontFamily: 'Alright Bold', textShadow: '1px 1px #ffc984'});
Cufon.replace('#footerAd strong', { fontFamily: 'Alright Medium', textShadow: '-1px -1px #da852d'});
Cufon.replace('#headingText h1', { fontFamily: 'Alright Sans', textShadow: '-1px -1px #de7c27'});
Cufon.replace('#footer strong', { fontFamily: 'Alright Bold', textShadow: '-1px -1px #27221c'});
Cufon.replace('#homeSlide1 h1', { fontFamily: 'Alright Medium', textShadow: '-1px -1px #cf5e1d'});


$(document).ready(function(){
	
	$('#homeSlideshow').before('<div id="homeMenu">')
	.cycle({ 
	    timeout: 6000,
		fx:      'fade',
		pager: '#homeMenu',
		after: onAfter
	});
	
	function onAfter()
	{
		$('#homeSlideshow li').width('100%');
	}
	
	$('#phoneSlideshow').cycle({ 
		timeout: 4000
	}); 
	
	$('#testimonialList').cycle({
		fx:     'fade', 
	    speed:  'fast', 
	    timeout: 0,
    	prev:   '#prev-test', 
    	next:   '#next-test'
	});
	
	$('#newsScroll').cycle({
		fx:     'fade', 
	    speed:  'fast', 
	    timeout: 0,
    	prev:   '#prev-news', 
    	next:   '#next-news',
		
		cleartypeNoBg: true
	});
	
	$('.modal1').jqm({trigger: 'a.trigger1'});
	$('a.trigger1').click(function() { 
		$('html,body').animate({scrollTop: 0}, 0);
	});
	
	$('#mod_content').cycle({
		fx:     'fade', 
	    speed:  'fast', 
	    timeout: 0
	});	
	
	$('#mod_content2').cycle({                      /*----- added for second gallery -----*/
		fx:     'fade', 
	    speed:  'fast', 
	    timeout: 0
	});
	
	$('.modal2').jqm({trigger: 'a.trigger2'});      /*----- added for second gallery -----*/
	$('a.trigger2').click(function() { 
		$('html,body').animate({scrollTop: 0}, 0);
	});
	
	/*------ links from thumbs to images ------*/
	
	$('ul.thumbs li').children('a').click(function() { 
		$('ul.thumbs').find('li.active').removeClass('active');
		$(this).parent().addClass('active');
	});
	
	$('#goto1').click(function() { 
        $('#mod_content').cycle(0); 
        return false; 
    });

    $('#goto2').click(function() { 
        $('#mod_content').cycle(1); 
        return false; 
    });

	$('#goto3').click(function() { 
        $('#mod_content').cycle(2); 
        return false; 
    });

    $('#goto4').click(function() { 
        $('#mod_content').cycle(3); 
        return false; 
    });

	$('#goto5').click(function() { 
        $('#mod_content').cycle(4); 
        return false; 
    });

    $('#goto6').click(function() { 
        $('#mod_content').cycle(5); 
        return false; 
    });
	
	$('#goto7').click(function() { 
        $('#mod_content').cycle(6); 
        return false; 
    });
	$('#goto8').click(function() { 
        $('#mod_content').cycle(7); 
        return false; 
    });

	/*------ second gallery ------*/
	
	$('#go1').click(function() { 
        $('#mod_content2').cycle(0); 
        return false; 
    });

    $('#go2').click(function() { 
        $('#mod_content2').cycle(1); 
        return false; 
    });

	$('#go3').click(function() { 
        $('#mod_content2').cycle(2); 
        return false; 
    });

    $('#go4').click(function() { 
        $('#mod_content2').cycle(3); 
        return false; 
    });

	$('#go5').click(function() { 
        $('#mod_content2').cycle(4); 
        return false; 
    });

    $('#go6').click(function() { 
        $('#mod_content2').cycle(5); 
        return false; 
    });

	/*------ end links ------*/


	$('#goto1').parent().addClass('active');	
	
	$('#go1').parent().addClass('active');	/*----- added for second gallery -----*/
	
	$('#mod-nav-thumb').cycle({
		fx:     'fade', 
	    speed:  'fast', 
	    timeout: 0,
		prev: '#modal_prev', 
		next: '#modal_next'
	});
	
	$('#mod-nav-thumb2').cycle({       /*----- added for second gallery -----*/
		fx:     'fade', 
	    speed:  'fast', 
	    timeout: 0,
		prev: '#modal_prev2', 
		next: '#modal_next2'
	});
	
	
	$.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) {
	    $(pager).find('li').removeClass('activeLI')
	        .filter('li:eq('+currSlideIndex+')').addClass('activeLI');
	};
	
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	
	/*------ active class links ------*/
	
	if($('body').hasClass('body-company')) { 
		$('li.company').addClass('current');
		//$('li.overview a').css({'color': '#ed7c17'});
		//$('li.menu-features').addClass('current');  
	}
	if($('body').hasClass('body-executive')) { 
		$('li.team').addClass('current');
		//$('li.menu-features').addClass('current');  
	}
	if($('body').hasClass('body-press')) { 
		$('li.press').addClass('current');
		//$('li.menu-features').addClass('current');  
	}
	if($('body').hasClass('body-privacy')) { 
		$('li.privacy').addClass('current');
		//$('li.menu-features').addClass('current');  
	}
	if($('body').hasClass('body-terms')) { 
		$('li.terms').addClass('current');
		//$('li.menu-features').addClass('current');  
	}
	if($('body').hasClass('body-testimonials')) { 
		$('li.testimonials').addClass('current');
		//$('li.menu-features').addClass('current');  
	}
	if($('body').hasClass('body-contact')) { 
		$('li.contactus').addClass('current');
		//$('li.menu-features').addClass('current');  
	}
	
	if($('body').hasClass('body-backup')) { 
		$('li.backup').addClass('current');
		$('li.menu-features').addClass('current');  
	}
	
	if($('body').hasClass('body-overview')) { 
		$('li.overview').addClass('current');
		$('li.menu-features').addClass('current');  
	}
	
	if($('body').hasClass('body-locate')) { 
		$('li.remote').addClass('current');
		$('li.menu-features').addClass('current');  
	}
	
	if($('body').hasClass('body-guardian')) { 
		$('li.personal').addClass('current');
		$('li.menu-features').addClass('current');  
	}
	
	if($('body').hasClass('body-security')) { 
		$('li.anti').addClass('current');
		$('li.menu-features').addClass('current');  
	}
	
	if($('body').hasClass('body-privacy')) { 
		$('li.featprivacy').addClass('current');
		$('li.menu-features').addClass('current');  
	}
	if($('body').hasClass('body-web')) { 
		$('li.web').addClass('current');
		$('li.menu-web').addClass('current');  
	}
	
	if($('body').hasClass('body-support-overview')) { 
		$('li.supportOverview').addClass('current'); 
	}
	if($('body').hasClass('body-support-blackberry')) { 
		$('li.bbSupport').addClass('current');
	}
	if($('body').hasClass('body-support-android')) { 
		$('li.droidSupport').addClass('current');
	}
	if($('body').hasClass('body-support-family')) { 
		$('li.familySupport').addClass('current');
	}
	if($('body').hasClass('body-support-contact')) { 
		$('li.contactSupport').addClass('current');  
	}
	
	if($('body').hasClass('body-resource-overview')) { 
		$('li.resourceOverview').addClass('current');  
	}
	if($('body').hasClass('body-resource-tips')) { 
		$('li.resourceTips').addClass('current'); 
	}
	if($('body').hasClass('body-resource-malware')) { 
		$('li.resourceMalware').addClass('current');
	}
	if($('body').hasClass('body-resource-news')) { 
		$('li.resourceNews').addClass('current');
	}
});


