//http://www.featureblend.com/license.txt
var FlashDetect=new function(){var self=this;self.installed=false;self.raw="";self.major=-1;self.minor=-1;self.revision=-1;self.revisionStr="";var activeXDetectRules=[{"name":"ShockwaveFlash.ShockwaveFlash.7","version":function(obj){return getActiveXVersion(obj);}},{"name":"ShockwaveFlash.ShockwaveFlash.6","version":function(obj){var version="6,0,21";try{obj.AllowScriptAccess="always";version=getActiveXVersion(obj);}catch(err){}
return version;}},{"name":"ShockwaveFlash.ShockwaveFlash","version":function(obj){return getActiveXVersion(obj);}}];var getActiveXVersion=function(activeXObj){var version=-1;try{version=activeXObj.GetVariable("$version");}catch(err){}
return version;};var getActiveXObject=function(name){var obj=-1;try{obj=new ActiveXObject(name);}catch(err){obj={activeXError:true};}
return obj;};var parseActiveXVersion=function(str){var versionArray=str.split(",");return{"raw":str,"major":parseInt(versionArray[0].split(" ")[1],10),"minor":parseInt(versionArray[1],10),"revision":parseInt(versionArray[2],10),"revisionStr":versionArray[2]};};var parseStandardVersion=function(str){var descParts=str.split(/ +/);var majorMinor=descParts[2].split(/\./);var revisionStr=descParts[3];return{"raw":str,"major":parseInt(majorMinor[0],10),"minor":parseInt(majorMinor[1],10),"revisionStr":revisionStr,"revision":parseRevisionStrToInt(revisionStr)};};var parseRevisionStrToInt=function(str){return parseInt(str.replace(/[a-zA-Z]/g,""),10)||self.revision;};self.majorAtLeast=function(version){return self.major>=version;};self.minorAtLeast=function(version){return self.minor>=version;};self.revisionAtLeast=function(version){return self.revision>=version;};self.versionAtLeast=function(major){var properties=[self.major,self.minor,self.revision];var len=Math.min(properties.length,arguments.length);for(i=0;i<len;i++){if(properties[i]>=arguments[i]){if(i+1<len&&properties[i]==arguments[i]){continue;}else{return true;}}else{return false;}}};self.FlashDetect=function(){if(navigator.plugins&&navigator.plugins.length>0){var type='application/x-shockwave-flash';var mimeTypes=navigator.mimeTypes;if(mimeTypes&&mimeTypes[type]&&mimeTypes[type].enabledPlugin&&mimeTypes[type].enabledPlugin.description){var version=mimeTypes[type].enabledPlugin.description;var versionObj=parseStandardVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revisionStr=versionObj.revisionStr;self.revision=versionObj.revision;self.installed=true;}}else if(navigator.appVersion.indexOf("Mac")==-1&&window.execScript){var version=-1;for(var i=0;i<activeXDetectRules.length&&version==-1;i++){var obj=getActiveXObject(activeXDetectRules[i].name);if(!obj.activeXError){self.installed=true;version=activeXDetectRules[i].version(obj);if(version!=-1){var versionObj=parseActiveXVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revision=versionObj.revision;self.revisionStr=versionObj.revisionStr;}}}}}();};FlashDetect.JS_RELEASE="1.0.4";

$(function() {
	
	/*Inserta video YouTube*/
	if(FlashDetect.installed) {   
	$('p.info-video').remove();
	
	$('#video-spot').flash({
		src: 'http://www.youtube.com/v/1YrlCN_ryDA',
		width: 213,
		height: 182,
		bgcolor: '#000000'
	});
	}
	
	$('#cover-flow').flash({
		src: 'http://www.carrerasconfuturo.com/coverflow.swf',
		width: 277,
		height: 157,
		bgcolor: '#FFFFFF',
		wmode: 'transparent',
		menu: false
	});
	
	/*Remueve parrafo con link hacia el video*/
	if(FlashDetect.installed) {   
		
	/*Animacion logo USMP*/
	$('#logo-b a').hide();
	$('#logo-b').flash({
		src: 'http://carrerasconfuturo.com/app-resources/swf/logo-usmp.swf',
		width: 240,
		height: 86,
		wmode: 'transparent'
	});	
   }
   
	
	/*Start sIFR*/

   if(FlashDetect.installed) {   
	$('.info-box .info-title strong').flash(
        { 
            src: 'http://carrerasconfuturo.com/app-resources/swf/helvetica-condensed.swf', 
			wmode: 'transparent',
            flashvars: { 
                css: [
                    '* {color: #ffffff; letter-spacing: -1px;}'
                ].join(' ')
            }
        },
        { version: 8 },
        function(htmlOptions) {
            htmlOptions.flashvars.txt = this.innerHTML;
            this.innerHTML = '<div>'+this.innerHTML+'</div>';
            var $alt = $(this.firstChild);
            htmlOptions.height = '26';
            htmlOptions.width = $alt.width();
            $alt.addClass('alt');
			$('html').addClass('sIFR-hasFlash');
            $(this)
                .addClass('flash-replaced')
                .prepend($.fn.flash.transform(htmlOptions));
			$('div.alt').hide();
        }
    );	
	
	$('.page-title').flash(
        { 
            src: 'http://carrerasconfuturo.com/app-resources/swf/helvetica-condensed.swf', 
			wmode: 'transparent',
            flashvars: { 
                css: [
                    '* {color: #303030; letter-spacing: -1px;}'
                ].join(' ')
            }
        },
        { version: 8 },
        function(htmlOptions) {
            htmlOptions.flashvars.txt = this.innerHTML;
            this.innerHTML = '<div>'+this.innerHTML+'</div>';
            var $alt = $(this.firstChild);
            htmlOptions.height = '30';
            htmlOptions.width = $alt.width();
            $alt.addClass('alt');
			$('html').addClass('sIFR-hasFlash');
            $(this)
                .addClass('flash-replaced')
                .prepend($.fn.flash.transform(htmlOptions));
			$('div.alt').hide();
        }
    );
	
	$('#career h3').flash(
        { 
            src: 'http://carrerasconfuturo.com/app-resources/swf/helvetica-condensed.swf', 
			wmode: 'transparent',
			height: '50',
            flashvars: { 
                css: [
                    '* {color: #000000; letter-spacing: -1px;}'
                ].join(' ')
            }
        },
        { version: 8 },
        function(htmlOptions) {
            htmlOptions.flashvars.txt = this.innerHTML;
            this.innerHTML = '<div>'+this.innerHTML+'</div>';
            var $alt = $(this.firstChild);
            htmlOptions.height = '45';
            htmlOptions.width = $alt.width();
            $alt.addClass('alt');
			$('html').addClass('sIFR-hasFlash');
            $(this)
                .addClass('flash-replaced')
                .prepend($.fn.flash.transform(htmlOptions));
			$('div.alt').hide();
        }
    );
	
   }
	/*End sIFR*/	

	/*Insercion de flash 'countdown' */
	if(FlashDetect.installed) {   
		$('#countdown_loc1 p').remove();
		$('#countdown_loc2 p').remove();
		
		$('#countdown_loc1').flash(
			{ src: 'http://carrerasconfuturo.com/app-resources/swf/countdown_flip_2days.swf',
			  width: 198,
			  height: 46,
			  wmode: 'transparent',
			  flashvars: { config_file: 'http://carrerasconfuturo.com/app-resources/xml/lima.xml' }
			},
			{ version: 8 }
		);
		
		$('#countdown_loc2').flash(
			{ src: 'http://carrerasconfuturo.com/app-resources/swf/countdown_flip_2days.swf',
			  width: 198,
			  height: 46,
			  wmode: 'transparent',
			  flashvars: { config_file: 'http://carrerasconfuturo.com/app-resources/xml/chiclayo.xml' }
			},
			{ version: 8 }
		);
	}
	
	/*CYCLE*/
	
	/*Sobreescribe funcion updateActivePagerLink para anadir clase 'current' */
	$.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) { 
    	$(pager).find('li').removeClass('current') 
        	.filter('li:eq('+currSlideIndex+')').addClass('current'); 
	}; 
	
   /*Inicia cycle para banner*/
   if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1)) {
	  $('#rotate').cycle({ 
		fx:     'fade',
		pager:  '#thumb-banner',   
		timeout: 0,
		// callback fn that creates a thumbnail to use as pager anchor 
		pagerAnchorBuilder: function(idx, slide) { 		
		   return '#thumb-banner li:eq(' + idx + ') a'; 
		} 
	}); 
	}
	else {
	$('#rotate').cycle({ 
		fx:     'fade',
		pager:  '#thumb-banner',   
		timeout: 5000,
		// callback fn that creates a thumbnail to use as pager anchor 
		pagerAnchorBuilder: function(idx, slide) { 		
		   return '#thumb-banner li:eq(' + idx + ') a'; 
		} 
	});
	}
	
	/*Inicia cycle para countdown*/
	$('#countdown').cycle({ 
		fx:     'scrollDown',
		pager:  '#counter > ul',  
		speed:  500, 
		timeout: 0, 
		cleartypeNoBg: true,
		// callback fn that creates a thumbnail to use as pager anchor 
		pagerAnchorBuilder: function(idx, slide) { 		
		   return '#counter > ul li:eq(' + idx + ') a'; 
		} 
	});
	
	/*TABS*/
	$('#career-info').cycle({ 
		fx:     'scrollLeft',
		pager:  '.tab-nav',  
		speed:  500, 
		cleartype: true,
		cleartypeNoBg: true,
		timeout: 0, 
		// callback fn that creates a thumbnail to use as pager anchor 
		pagerAnchorBuilder: function(idx, slide) { 		
		   return '.tab-nav li:eq(' + idx + ') a'; 
		} 
	});
	
	
	/*STYLE SWITCHER*/
	
	/*Eventos para cambiar de estilo con los links*/
	$('#theme1').click(function(){
	
		setActiveStyleSheet('Estilo Granate');
		return false;
	});
	
	$('#theme2').click(function(){
	
		setActiveStyleSheet('Estilo Celeste');
		return false;
	});
	
	$('#theme3').click(function(){
	
		setActiveStyleSheet('Estilo Verde');
		return false;
	});
	
	/*Bubble*/
	if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1)) { }
	else {
	function bounceBubble(){
		$(".bubble").fadeIn(100).animate({top:"-=20px"},100).animate({top:"+=20px"},100).animate({top:"-=20px"},100)
		.animate({top:"+=20px"},100).animate({top:"-=20px"},100).animate({top:"+=20px"},100);
	}
	
	setInterval(bounceBubble,5000); 
   }
	

});