// JavaScript Document

 jQuery(document).ready(function() {
   // doc ready stuff
 
	xFormat();
	fixnav();
	flashify();
	extLinks();								   
	mexy();
	
	jQuery(window).resize(function() {
  		jQuery('#nav').removeClass('fixed'); 
	});

// end doc ready
 });


function xFormat() {
// additional formatting
 jQuery( ".combi:first" ).not(".quote").css('font-size','17px');	
}

function fixnav() {
  var msie6 = jQuery.browser == 'msie' && jQuery.browser.version < 7;
  if (!msie6) {
	  var top = jQuery('#nav').offset().top - parseFloat(jQuery('#nav').css('margin-top').replace(/auto/, 0));

    	jQuery(window).scroll(function () { 
		var st = jQuery(this).scrollTop();
      	if (st >= top) { 
			jQuery('#nav').addClass('fixed'); 
			
			
				/* html */
				var links='<dl>';
				links+='<dt>My Links</dt>';
				links+='<dd><a href="http://www.internationalartistes.com/artists/Suki%20Webster/">International Artistes</a></dd>';
				links+='<dd><a href="http://www.comedystoreplayers.com/">Comedy Store Players</a></dd>';
				links+='<dd><a href="http://www.harveyvoices.co.uk/profile/view/suki_webster">Harveys Voices</a></dd>';
				links+='</dl>';
				
				
				/* calc if we have space for extra div */
				var n = jQuery('#nav').offset().top;
				var f = jQuery(".ftR").offset().top;
				var h=jQuery('#nav').height();
				var o=f-n-h-200;
				var pos=f-100;
				jQuery('body').prepend('<div id="links" style="top:'+pos+'px">'+links+'</div>');
				
				extLinks();	
				
			} else { 
			jQuery('#nav').removeClass('fixed'); 
			}
		});

	}
}


function flashify() {
		
		var flashVersion=8;
	
	   jQuery("#logo").flash(
        { 
          src: '/wp-content/themes/suki/images/logo.swf',
          width: 615,
          height: 208,
		  wmode: 'transparent' 
        },
        { version: flashVersion, update: false }
    );
	
	// test if logo has been replaced 'emb' or unchanged 'img'
	var logohtml=jQuery("#logo").html();
	var flashed=(logohtml.substr(1,3)=='img')? false : true;
	//var flashed=true;
	
	if(flashed) {  
	
			// Loop over each H2 element
			jQuery( "#main h2,#blogtitle" ).not(".post h2").each(
			function(){
			
			// adjust margins
			jQuery(this).css('margin','0 0 6px -10px');
			
			var textval=jQuery(this).html();
						
			jQuery(this).html('');
			jQuery(this).css('background','none');
			
			// jQuery flash plugin
			
			jQuery(this).flash(
			{ 
			  src: '/wp-content/themes/suki/images/taper.swf?',
			  width: 586,
			  height: 56,
			  wmode: 'transparent',
			  flashvars: { subtx : textval.toUpperCase() }
			},
			{ version: flashVersion, update: false }
			);
			
			}
			);
	}

  
	
}


function extLinks() {
	 jQuery("a[href^='http:']").not("[href*='sukiwebster.com']").attr('target','_blank');
}

function mexy() {
var e=0;
mc=new Array()
mc[0]='3953323043275527566255272459322752245530275260523224552324592333573039';
op='';chars='st2-n74opr.uyqz9m:0vwk_5x16hjab3igcdel8@f'; m='39525560243040'; // +op.substr(7)+
inp=m+mc[e];for(i=0; i<inp.length; i+=2) {id=parseInt(inp.substr(i,2));op+=chars.charAt(id-23);}
jQuery("#iacom").html('<a href="'+op+'"><img src="/wp-content/themes/suki/images/trans.gif" alt="AGENT: International Artistes, MALCOME BROWNING, 020 7025 0633"></a>');
}

