//Main Navigation
    var mainNavUpdating=false;
    var mainCell=null;
    var show=new Array();
    show[0]="Hi, i'm Becky Rose aka Bekka Hax and I am one of those scatty creative types.";
    show[1]="When I am DJing you can request and dedicate songs directly from the site, feel free to browse my music collection at any time, unfortunately you cannot download or listen as that would be illegal, so the music barons insist.";
    show[2]="My comics are free for all and I hope they make you smile, they are about a flamboyant sociolate called Bekka - oh the parallels!";
    show[3]="In the software section you can find some programs that I have written or contributed too.  I've worked on hundreds of projects over the years across many platforms but only a handful are shown here.";
    show[4]="Poetry is something I pickup and put down every now and then, sadly I lost a lot of my poems but here you can find some of my work.  I write from the heart and without discipline or conforming to rules or conventions and I make no appologies, it is what it is.";
    show[5]="All the videos i've published or enjoyed on You Tube. You can subscribe to my <a href='http://youtube.com/user/beckyrosei/' target='_new'>You Tube channel</a> here.";
    show[6]="User Control Panel.";
    var showing=-1;

    function mainNav( cell ){
        if( cell!=showing && mainNavUpdating==false ){
            mainNavUpdating=true;
            if( navigator.appName.indexOf("Internet Explorer")>-1 ){
                $('#mainNavText').fadeOut(
                    "slow"
                    ,function(){
                        document.getElementById('mainNavText').innerHTML = "<br>"+show[cell];
                        $('#mainNavText').fadeIn("slow",function(){ mainNavUpdating=false; })
                    }
                );
                showing=cell;
            }
            else {
                $('#mainNavText').slideUp(
                    "slow"
                    ,function(){
                        document.getElementById('mainNavText').innerHTML = "<br>"+show[cell];
                        $('#mainNavText').slideDown("slow",function(){ mainNavUpdating=false; })
                    }
                );
                showing=cell;            
            }
        }
        else {
            if( cell!=showing ){
                mainCell=cell;
                setTimeout( 'mainNav( mainCell );',100 );
            }
        }
    }
    
//Secondary Navigation
    var secondNavUpdating=false;
    var secondType=null;
    var secondCell=null;
    var secondshow=new Array();
    secondshow['none']=new Array();
    secondshow['none'][0]="<center>The world is not divided by national borders, skin colour and sexuality. It is divided by peoples attitudes toward them.</center>";
    //secondshow['none'][0]="<div style='height: 407px;'><img src='images/friends.png' class='png' alt='some friends'/></div>";
    secondshow['music']=new Array();
    secondshow['music'][1]="Whether you are looking for power metal groups like Children of Bodum, some Viking Metal by Amon Amarth or you just cant believe Walls of Jericho and Arch Enemy are fronted by women, this is where I keep my heaviest music.";
    secondshow['music'][2]="From the energetic pop-goth sounds of Lovecrave to the orchestral metal of In Extremo via the haunted sounds of bands like Carfax Abbey and Faith and the Muse, my gothic metal collection is one of my favorites.";
    secondshow['music'][3]="I could not decide whether Iron Maiden where Rock or Metal, so I made both genre's one group!  From ballad specialists like Bon Jovi to Kiuas and Lordi, this is where the mainstream metal goes.";
    secondshow['music'][4]="Looking for something alternative like Garbage, Placebo or Feeder? Whether it's Britpop, indie rock, or alternative you'll find the punk here.  After much consideration i've put some Black Metal in here too.";
    secondshow['music'][5]="Whether it's a golden oldie from Tina Turner, or a pop classic from Martika or Britney Spears you are looking for then my soft collection is for you.";
    secondshow['music'][6]="I don't have an extensive collection of dance and club music but I do have some, whether it's Madonna, the re-invented Tiffany, or your taste is more some DJ Scooter Techno or some Drum 'n' Bass then it's in here.";
    secondshow['music'][7]="For the more distinguished connosiuer or that after party chill-out this collections covers great classics like Wagner to modern masterpieces from Rondo' Veneziano";
    secondshow['music'][8]="I put some odds and ends in here which don't really fit anywhere else and don't get played often.";
    secondshow['poetry']=new Array();
    for(n=1;n<256;n++){ secondshow['poetry'][n]=''; }
    secondshow['comic']=new Array();
    secondshow['comic'][1]="This is a comic that I make, producing a few episodes each month (usually in a quick flurry then nothing for ages).<br><br>Bekka is a flamboyant lesbian and socialite in the fictional town of Fordham-by-the-sea, her outward confidence betrays her disasterous tendancy for things to never quite go to plan.";
    secondshow['comic'][2]="Join the Facebook group to be notified of each months new episodes.";
    secondshow['comic'][3]="If you use RSS then you can get instant notification of new episodes by subscribing to the Bekka & Taffy RSS feed";
    secondshow['software']=new Array();
    secondshow['software'][1]="Second Life Clothes Previewer is an open source project which I contributed too, adding many features and enhancements to Joe Hockling's original utility.<br><br>It is a tool useful for clothes designers in Second Life, allowing them to easily and quickly see their textures in 3D as they create them.<br><br>Available for PC & Mac.";
    secondshow['software'][2]="This is a small game I wrote a few years ago when learning a new programming language.<br><br>It is a simple overhead shoot 'em up with space ships.<br><br>Available for PC & Mac.";

    secondshow['video']=new Array();
    secondshow['video'][1]="Poetry recitals";
    secondshow['video'][2]="STCC videos";
    secondshow['video'][3]="Random videos";
    secondshow['video'][4]="Stuff I favorited";
    secondshow['video'][5]="Stuff my freinds uploaded";
    
    secondshow['user']=new Array();
    secondshow['user'][1]="You can configure your personal details here.";
    secondshow['user'][2]="You can put more credit on your account here which are useable for services which cost money such as SMS";
    secondshow['user'][3]="You can configured your notification settings here.";
    secondshow['user'][4]="You can send files to other site members here.";
    secondshow['user'][5]="You can send SMS text messages from here.";

    var secondshowing=-1;
    function secondNav( type,cell ){
        if( cell!=secondshowing && secondshow[type][cell] && secondNavUpdating==false ){
            secondNavUpdating=true;
            if( navigator.appName.indexOf("Internet Explorer")>-1 ){
                $('#secondNavText').fadeOut(
                    "slow"
                    ,function(){
                        document.getElementById('secondNavText').innerHTML = "<br>"+secondshow[type][cell];
                        $('#secondNavText').fadeIn("slow",function(){ secondNavUpdating=false; })
                    }
                );
            }
            else {
                $('#secondNavText').slideUp(
                    "slow"
                    ,function(){
                        document.getElementById('secondNavText').innerHTML = "<br>"+secondshow[type][cell];
                        $('#secondNavText').slideDown("slow",function(){ secondNavUpdating=false; })
                    }
                );            
            }
            secondshowing=cell;
        }
        else {
            if( cell!=secondshowing && secondshow[type][cell] ){
                secondType=type;
                secondCell=cell;
                setTimeout( 'secondNav( secondType,secondCell );',100 );
            }
        }
    }
    
//Comic Content
    var showPage=1;
    function turnPage( page ){
        showPage=showPage+page;
        if( showPage<1 ) showPage=1;
        if( showPage>23 ) showPage=23;
        $('#leftPage').fadeOut("fast",function(){
            document.getElementById('leftPage').innerHTML = document.getElementById('comicPage'+showPage).innerHTML;
            $('#leftPage').fadeIn("fast");
        });
        $('#rightPage').fadeOut("fast",function(){
            document.getElementById('rightPage').innerHTML = document.getElementById('comicPage'+(showPage+1)).innerHTML;
            $('#rightPage').fadeIn("fast");
        });
    }
	function showComicLarge( page ){
		$('#pageBlack').fadeIn("slow",function(){
			activeComic=document.getElementById('showComic');
			activeComic.innerHTML='<img src="'+document.getElementById('comicLarge'+page).innerHTML+'" alt=""/>';
            document.getElementById('showComic').style.display='block';
//			setTimeout("activeComic.style.marginLeft=-activeComic.clientWidth/2+'px';",1000);
			$('#showComic').fadeIn("slow");
            document.getElementById('showComic').style.visibility='visible';
		});
		document.getElementById('pageBlack').style.display='block';
	}
	function hideComic(){
		$('#showComic').fadeOut("slow",function(){
            document.getElementById('showComic').style.visibility='hidden';
			$('#pageBlack').fadeOut("slow",function(){
				document.getElementById('pageBlack').style.display='none';
			});
			document.getElementById('showComic').style.display='none';
		});
	}
	
//Page Content
    var fadeContent;
    var newJS;
    function showContent( pageObject,type,cell,params ){
        
        var xmlHttp;
        try{ xmlHttp=new XMLHttpRequest(); }
        catch (e){
            try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
            catch (e){
                try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
                catch (e){
                    alert("Your browser does not support Ajax");
                    return false;
                }
            }
        }
        xmlHttp.onreadystatechange=function(){
            if(xmlHttp.readyState==4){
                fadeContent=xmlHttp.responseText;
                
                if( fadeContent.indexOf('[script]')>-1 ){
                    var newJS=fadeContent.slice( fadeContent.indexOf('[script]') ).substr( 8 );
                    fadeContent=fadeContent.substr( 0,fadeContent.indexOf('[script]') );
                }
                
                if (pageObject=='content'){
                    $('#right').fadeOut(1200,function(){
                        document.getElementById('ajaxMainDelivery').innerHTML=fadeContent
                        if( fadeContent.indexOf('directURL')>-1 ){
                            $('#showURL').fadeOut("slow",function(){
                                document.getElementById('showURL').innerHTML='<a href="'+document.getElementById('directURL').innerHTML+'">'+document.getElementById('directURL').innerHTML+'</a>';
                                $('#showURL').fadeIn("slow");
                            });
                        }
                        $(".bound").corner();
                        unbound();
                        $('#right').fadeIn(1200);
                        if( newJS ) eval( newJS );
                    });
                }
                else {
                    if (pageObject=='menu') {
                        if( navigator.appName.indexOf("Internet Explorer")>-1 ){
                            $('#box2').fadeOut(1200,function(){
                                document.getElementById('ajaxMenuDelivery').innerHTML=fadeContent;  
                                $(".bound").corner();
                                unbound();
                                $('#box2').fadeIn(1200);
                                if( newJS ) eval( newJS );
                            });
                        }
                        else {
                            $('#box2').slideUp(1200,function(){
                                secondshowing=-1;
                                document.getElementById('ajaxMenuDelivery').innerHTML=fadeContent;  
                                $(".bound").corner();
                                unbound();
                                $('#box2').slideDown(1200);
                                if( newJS ) eval( newJS );
                            });
                        }
                    }
                }
            }
        }
        if(params){
            xmlHttp.open("POST","ajax.php?"+pageObject+"="+type+"&item="+cell,true);
            xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlHttp.setRequestHeader("Content-length", params.length);
            xmlHttp.setRequestHeader("Connection", "close");
            xmlHttp.send(params);
        }
        else {
            xmlHttp.open("GET","ajax.php?"+pageObject+"="+type+"&item="+cell,true);
            xmlHttp.send(null);
        }
    }

//Resource
    function unbound(){
        var element = document.getElementsByTagName('div');
        for (var i = 0; i < element.length; i++){
            var elementClass=element[i].className;            
            if( elementClass.indexOf('bound')>-1 ){
                element[i].className=elementClass.replace('bound','-x-');
            }
        }
    }





function flipString(aString) {
    aString = aString.toLowerCase();
    var last = aString.length - 1;
    var result = '';
    for (var i = last; i >= 0; --i) {
        result += flipChar(aString.charAt(i))
    }
    return result;
}

function flipChar(c) {
    if (c == 'a') {
        return '\u0250'
    }
    else if (c == 'b') {
        return 'q'
    }
    else if (c == 'c') {
        return '\u0254' //Open o -- copied from pne
    }
    else if (c == 'd') {
        return 'p'
    }
    else if (c == 'e') {
        return '\u01DD'
    }
    else if (c == 'f') {
        return '\u025F' //Copied from pne -- 
        //LATIN SMALL LETTER DOTLESS J WITH STROKE
    }
    else if (c == 'g') {
        return 'b'
    }
    else if (c == 'h') {
        return '\u0265'
    }
    else if (c == 'i') {
        return '\u0131'//'\u0131\u0323' //copied from pne
    }
    else if (c == 'j') {
        return '\u0638'
    }
    else if (c == 'k') {
        return '\u029E'
    }
    else if (c == 'l') {
        return '1'
    }
    else if (c == 'm') {
        return '\u026F'
    }
    else if (c == 'n') {
        return 'u'
    }
    else if (c == 'o') {
        return 'o'
    }
    else if (c == 'p') {
        return 'd'
    }
    else if (c == 'q') {
        return 'b'
    }
    else if (c == 'r') {
        return '\u0279'
    }
    else if (c == 's') {
        return 's'
    }
    else if (c == 't') {
        return '\u0287'
    }
    else if (c == 'u') {
        return 'n'
    }
    else if (c == 'v') {
        return '\u028C'
    }
    else if (c == 'w') {
        return '\u028D'
    }
    else if (c == 'x') {
        return 'x'
    }
    else if (c == 'y') {
        return '\u028E'
    }
    else if (c == 'z') {
        return 'z'
    }
    else if (c == '[') {
        return ']'
    }
    else if (c == ']') {
        return '['
    }
    else if (c == '(') {
        return ')'
    }
    else if (c == ')') {
        return '('
    }
    else if (c == '{') {
        return '}'
    }
    else if (c == '}') {
        return '{'
    }
    else if (c == '?') {
        return '\u00BF' //From pne
    }
    else if (c == '\u00BF') {
        return '?'
    }
    else if (c == '!') {
        return '\u00A1'
    }
    else if (c == '\'') {
        return ','
    }
    else if (c == ',') {
        return '\''
    }
    return c;
}
