//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() {	
		 	
	$('.nwk-button.nwk-tw').each(function() {
			var iframeTweet = "";
			iframeTweet += "<iframe scrolling=\"no\" height=\"61\" frameborder=\"0\" width=\"50\" src=\"http:\/\/api.tweetmeme.com\/widget.js?url=" + escape($(this).parents('.post').find('.permlink').attr('href')) + "&amp;style=normal&amp;source=carrerasfuturo&amp;service=bit.ly\"><\/iframe>";			
			$(this).append(iframeTweet);
	});
	
	$('.small-buttons .nwk-button.nwk-tw-compact').each(function() {
			var iframeTweetCompact = "";
			var urlin="";
			//if(($(this).parents('.post').find('.permlink').attr('href'))!=undefined){
				urlin=$('.post').find('.permlink').attr('href');
			//}else{
				//urlin=$(this).parents('.post-extras').find('.linkpostpermant').attr('href');
			//}
			iframeTweetCompact += "<iframe scrolling=\"no\" height=\"20\" frameborder=\"0\" width=\"90\" src=\"http:\/\/api.tweetmeme.com\/widget.js?url=" + escape($('.post').find('.permlink').attr('href')) + "&amp;style=compact&amp;source=carrerasfuturo&amp;service=bit.ly\"><\/iframe>";			
			$(this).append(iframeTweetCompact);
	});
	
	$('.fb-like').each(function(){
		var iframeFB = "";
		iframeFB = "<iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?href=" + escape($(this).parents('.post').find('.permlink').attr('href')) + "&amp;layout=button_count&amp;show_faces=false&amp;width=80&amp;action=like&amp;colorscheme=light&amp;locale=es_ES\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"border:none; overflow:hidden; width:110px; height:21px; vertical-align:middle\"><\/iframe>";
		$(this).append(iframeFB);
	});
	
	$('#fb-fans').append("<iframe scrolling=\"no\" height=\"246\" frameborder=\"0\" width=\"300\" allowtransparency=\"true\" src=\"http:\/\/www.facebook.com\/connect\/connect.php?id=113692649814&amp;connections=10&amp;stream=0&css=http:\/\/www.carrerasconfuturo.com\/wp-content\/themes\/default\/css\/fan.css&amp;locale=es_ES\" class=\"fb-fan-box\"><\/iframe>");
		
	$('#fb-becomefan').append("<iframe scrolling=\"no\" height=\"48\" frameborder=\"0\" width=\"100\" allowtransparency=\"true\" src=\"http:\/\/www.facebook.com\/connect\/connect.php?id=125802874115397&amp;connections=0&amp;stream=0&amp;logobar=false&amp;css=http://www.carrerasconfuturo.com\/wp-content\/themes\/default\/css\/like.css&amp;locale=es_ES\" class=\"fb-fan-box\"><\/iframe>");
	
	
	/*Insercion de flash 'countdown' */
	if(FlashDetect.installed) {   
		$('#countdown_loc1 p').remove();
		$('#countdown_loc2 p').remove();
		
		$('#countdown_loc1').flash(
			{ src: 'http://carrerasconfuturo.com/wp-content/themes/default/swf/countdown_flip_2days.swf',
			  width: 176,
			  height: 43,
			  wmode: 'transparent',
			  flashvars: { config_file: 'http://carrerasconfuturo.com/wp-content/themes/default/xml/lima.xml' }
			},
			{ version: 8 }
		);
		
		$('#countdown_loc2').flash(
			{ src: 'http://carrerasconfuturo.com/wp-content/themes/default/swf/countdown_flip_2days.swf',
			  width: 176,
			  height: 43,
			  wmode: 'transparent',
			  flashvars: { config_file: 'http://carrerasconfuturo.com/wp-content/themes/default/xml/chiclayo.xml' }
			},
			{ version: 8 }
		);
	}
	
	$('#summary-more').click(function(){	
		$(this).fadeOut();
		$('#intro-expand').fadeTo('',1,'').slideDown();
		return false;
	});
	$('#summary-less').click(function(){		
		$('#intro-expand').fadeTo('',0,'').slideUp();
		$('#summary-more').fadeIn();
		return false;
	});
	
	$('#author-more').click(function(){	
		$(this).fadeOut();
		$('#author-expand').fadeTo('',1,'').slideDown();
		return false;
	});
	$('#author-less').click(function(){		
		$('#author-expand').fadeTo('',0,'').slideUp();
		$('#author-more').fadeIn();
		return false;
	});
	
	//JW Payer
	$(".video-player").each(function(){
		var videoType = $(this).find("a").attr("rel");
		var videoPath = $(this).find("a").attr("href");
		var videoImage = $(this).find("img").attr("src");		
		var videoW = $(this).find("img").attr("width");
		var videoH = $(this).find("img").attr("height");
		if(FlashDetect.installed){
			$(this).empty();
			$(this).flash(
				{ src: 'http://carrerasconfuturo.com/wp-content/themes/default/swf/player.swf',
				  width: videoW,
				  height: videoH,
				  wmode: 'transparent',
				  allowfullscreen: true,
				  flashvars: { 
					file: videoPath, 
					image: videoImage, 
					stretching: 'exactfit',
					skin: 'http://carrerasconfuturo.com/wp-content/themes/default/swf/skin/modieus.xml'
					}
				},
				{ version: 8 }
			);
		} else {
			if(videoType == 'youtube'){
				$(this).empty();
				var embedVid = "<object width=\"" + videoW + "\" height=\"" + videoH + "\"><param name=\"movie\" value=\"" + videoPath + "\"><\/param><param name=\"allowFullScreen\" value=\"true\"><\/param><param name=\"allowscriptaccess\" value=\"always\"><\/param><embed src=\"" + videoPath + "\"&hl=es_ES&fs=1&\" type=\"application\/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"" + videoW + "\" height=\"" + videoH + "\"><\/embed><\/object>";
				
				$(this).append(embedVid);
			}
		}

	});
	
	/*PICASA*/

	$("#picasa-gallery").pwi({
	  username: 'carrerasconfuturo',
	  maxResults: 5,
	  albumMaxResults: 5,
	  thumbSize: 72,
	  albumThumbSize: 72,
	  mode: 'albums',
	  album: '',	  
	  thumbCss: { margin: '0 28px 10px 0' },
	  showSlideshowLink: false,
	  showAlbumdate: false
	});
		
	$('.icon-picasa a').hover(
		function(){$('.gallery small').show();},
		function(){$('.gallery small').hide();}
	);
	
	/*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'); 
	}; */
	
		
	$(".tweet").getTwitter({
		userName: "carrerasfuturo",
		numTweets: 2,
		loaderText: "Cargando twitts...",
		slideIn: false,
		showHeading: false,
		showProfileLink: false

	});
	
	/*STYLE SWITCHER*/
	
	/*Eventos para cambiar de estilo con los links*/
	$('#theme1').click(function(){
	
		setActiveStyleSheet('Estilo Granate');
		Cufon.refresh()
		return false;
	});
	
	$('#theme2').click(function(){
	
		setActiveStyleSheet('Estilo Celeste');
		Cufon.refresh()
		return false;
	});
	
	$('#theme3').click(function(){
	
		setActiveStyleSheet('Estilo Verde');
		Cufon.refresh()
		return false;
	});
	
	$('#theme4').click(function(){
	
		setActiveStyleSheet('Estilo Amarillo');
		Cufon.refresh()
		return false;
	});
	
	/*Bubble*/
	if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1)) { }
	else {
	function bounceBubble(){
		$(".bubble,#info-label").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); 
   }
   
   $('#adv').flash(
	  { src: '/wp-content/themes/default/swf/cu3er.swf',
		width: 850,
		height: 150,
		wmode: 'transparent',
		flashvars: { xml: '/wp-content/themes/default/xml/config.xml' }
	  },
	  { version: 8 }
  );
   
   
   $('.vote-up').toggle(function(){$(this).addClass('vote-up-on');},function(){$(this).removeClass('vote-up-on');});
   $('.vote-down').toggle(function(){$(this).addClass('vote-down-on');},function(){$(this).removeClass('vote-down-on');});
   
   $('#add-friends').click(function(){
		$('#hidden-content .friend-list').clone(true).appendTo('#friends-added').show();
		return false;
	});
   
   $('.open-chat').click(function(){
		var chatURL = $(this).attr('href');
		var w = 580;
		var h = 480;
		var winl = (screen.width-w)/2;
		var wint = (screen.height-h)/2;
		settings='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=no,toolbar=no'
		window.open(chatURL, "Chat de Admisión",settings).focus();	
		return false;
	});
   	
	/*
	jQuery(document).ready(function() {
		var rutaori = document.location.href;
		if(rutaori=="http://www.carrerasconfuturo.com/" || rutaori=="http://www.carrerasconfuturo.com" || rutaori=="http://carrerasconfuturo.com"  || rutaori=="http://carrerasconfuturo.com/" || rutaori=="www.carrerasconfuturo.com" || rutaori=="www.carrerasconfuturo.com/"){
			$.get('http://www.carrerasconfuturo.com/ventana-flotante/', function(data) { $.facebox(data) }); 	
		}
		
	})	
   */
   $('a[rel*=facebox]').facebox();
   
   // $('.want-avatar').click(function(){ jQuery.facebox('<div class=\"single\"><p>Nuestra sitio web soporta <a href=\"http:\/\/gravatar.com\" target=\"_blank\"><strong>Gravatar</strong></a>, un servicio que te permite tener un avatar para identificarte y el cual puede ser usado en todos los sitios web que lo soporten. Tu avatar se mostrar&aacute; junto a cada comentario que hagas.</p> <p>Para que aparezca tu avatar en nuestro sitio web debes <a href=\"http:\/\/gravatar.com/site/signup\" target=\"_blank\"><strong>registrarte</strong></a> en el sitio web de Gravatar (es gratis) y utiliza el mismo e-mail que usaste en nuestro sitio web para publicar tu comentario.</p></div>'); return false; });

});
