start = function()
{
	 picz= new Image();
     picz.src="images1/testimUP.gif"; 
pic2= new Image();
     pic2.src="images1/testimHO.gif"; 
pic3= new Image();
     pic3.src="images1/glossaryUP.gif"; 
pic4= new Image();
     pic4.src="images1/glossaryHO.gif"; 
pic5= new Image();
     pic5.src="images1/opportunityUP"; 
pic6= new Image();
     pic6.src="images1/opportunityHO"; 
pic7= new Image();
     pic7.src="images1/questionsUP.gif"; 
pic8= new Image();
     pic8.src="images1/questionsHO.gif"; 
pic9= new Image();
     pic9.src="images1/contactUP.gif"; 
pica= new Image();
     pica.src="images1/contactHO.gif"; 
picb= new Image();
     picb.src="images1/psychicHO.gif"; 
picc= new Image();
     picc.src="images1/psychicUP.gif"; 

var smartHoverBox = function(boxTimer, xOffset, yOffset, smartBoxSuffix, smartBoxClose) {
    var smartBoxes = $(document.body).getElements('[id$=' + smartBoxSuffix + ']');
    var closeElem = $(document.body).getElements('.' + smartBoxClose);
    var closeBoxes = function() {
        smartBoxes.setStyle('display', 'none');
    };
    closeElem.addEvent('click', function(){
        closeBoxes()
    }).setStyle('cursor', 'pointer');
    var closeBoxesTimer = 0;
    smartBoxes.each(function(item){
        var currentBox = item.getProperty('id');
        currentBox = currentBox.replace('' + smartBoxSuffix + '', '');
        if (document.getElementById(currentBox)) {
            $(currentBox).addEvent('mouseleave', function(){
                closeBoxesTimer = closeBoxes.delay(boxTimer);
            });

            item.addEvent('mouseleave', function(){
                closeBoxesTimer = closeBoxes.delay(boxTimer);
            });

            $(currentBox).addEvent('mouseenter', function(){
                if($defined(closeBoxesTimer)) $clear(closeBoxesTimer);
            });

            item.addEvent('mouseenter', function(){
                if($defined(closeBoxesTimer)) $clear(closeBoxesTimer);
            });



            item.setStyle('margin', '0');
            $(currentBox).addEvent('mouseenter', function(){
                smartBoxes.setStyle('display', 'none');
                item.setStyles({
                    display: 'block',
                    position: 'fixed'
                }).setStyle('z-index', '1000000');

                //coordinates and size vars and math
                var windowSize = $(window).getSize();
                var windowScroll = $(window).getScroll();
                var halfWindowY = windowSize.y / 2;
                var halfWindowX = windowSize.x / 2;
                var boxSize = item.getSize();
                var inputPOS = $(currentBox).getCoordinates();
                var inputCOOR = $(currentBox).getPosition();
                var inputSize = $(currentBox).getSize();
                var inputBottomPOS = inputPOS.top + inputSize.y;
                var inputBottomPOSAdjust = inputBottomPOS // - windowScroll.y *position is fixed
                var inputLeftPOS = inputPOS.left + xOffset;
                //       var inputRightPOS = inputPOS.right;
                var leftOffset = inputCOOR.x + xOffset;
                posY = $(currentBox).getPosition();
                item.setStyle('top', (posY.y - boxSize.y));
                posX = inputPOS.right - boxSize.x - xOffset + 85;
                if (posX > (getBrowserWidth()- boxSize.x)) posX -=boxSize.x/1.2;
                if (posX < 0) posX += boxSize.x/.6;
                item.setStyle('left', posX);
               
            }).setStyle('cursor', 'pointer');
        }
    });
}
// end box script

//window fit script by Yummy Jellybaby
function getWidth(){
    if (window.innerWidth){
        return window.innerWidth;
    } else if (document.documentElement && document.documentElement.clientWidth != 0){
        return document.documentElement.clientWidth;
    }
    else if (document.body){
        return document.body.clientWidth;
    } else if (document.body.offsetWidth){
        return document.body.offsetWidth;
    } return 0;
}
scale = function(){
    var BW = getWidth();
    document.getElementById("water").style.width=BW-300;
    document.getElementById("Ttop").style.width=BW-152;
    document.getElementById("sub_page").style.width=BW-300;
    document.getElementById("Tb1").style.width=BW-300;
    document.getElementById("pic1").style.width=BW-400;
    setMenuPosition();
}

function logme(){
    eraseCookie('psychic');
    window.location = "./index.php"
}
chooser = function(page){
    switch(page){
        case 'psychic_medium': window.location = "./psychic_medium.php";
            break;
        case 'psychic_questions': window.location = "./psychic_questions.php";
            break;
        case 'opportunity_knocks': window.location = "./opportunity_knocks.php";
            break;
        case 'psychic_glossary': window.location = "./psychic_glossary.php";
            break;
        case 'psychic_testimonials': window.location = "./psychic_testimonials.php";
            break;
        case 'feed_back': window.location = "./feed_back.php";
            break;
    }
}
setMenuPosition = function(){
    if (getBrowserHeight() > 410){
        Y = getBrowserHeight()/3 + getScrollXY()[1];
        if (Y <30 ) Y=30;
        Pwidth =  $('contentpane').getStyle('width');
        if (Y > 550) Y-=455;
        $('menu').setStyles({
            width: Pwidth,
            top: Y
        });
    }
}
/*reSet = function(){
    if (document.all) {
        $('menu').setStyle('left', '72px' );//got to bail internet agian out again
        $('h6').setStyle('font-size', '40px'); alert($('h6').getStyle('font-size'))
    }
        
}*/

fa = function(){
    this.tween('opacity', 1);
}
fb = function(){
    this.tween('opacity', .1);
}
window.addEvent('domready', function(){
	$('main').setStyle('background-image','url(images1/stars.jpg)');
    smartHoverBox(
        100, //delay before vanishing
        0, //x offset
        -30,  //y offset
        '_smarthbox', //smart hover box suffix
        'smarthbox_close' //hover box close class
        );
  //  reSet();
    fixit();
   setTimeout("fixit()",3000);
    var a = $$('.fader');
    var b = $('buttonbox');
	b.setStyle('opacity',1);
    a.setStyle('opacity',0);
    fa.delay(1500,a);
	$('b1').setStyle("background-image","url(images1/psychicUP.gif)");
$('b2').setStyle("background-image","url(images1/questionsUP.gif)");
$('b3').setStyle("background-image","url(images1/opportunityHO.gif)");
$('b3').setStyle("background-image","url(images1/opportunityUP.gif)");
$('b4').setStyle("background-image","url(images1/glossaryHO.gif)");
$('b4').setStyle("background-image","url(images1/glossaryUP.gif)");
$('b5').setStyle("background-image","url(images1/testimHO.gif)");
$('b5').setStyle("background-image","url(images1/testimUP.gif)");
$('b7').setStyle("background-image","url(images1/contactHO.gif)");
$('b7').setStyle("background-image","url(images1/contactUP.gif)");
    document.addEvent('mousemove',function(){
        b.setStyle('opacity', 1);
		fb.delay(1000,b);
    });
   
    $('b1').addEvent('mouseenter',function(){
        $('b1').setStyle('background-image','url(images1/psychicHO.gif)');
        moo =  $('b1').getStyle('background-image');
    //     alert('moo '+moo);
    });
    $('b1').addEvent('mouseleave',function(){
        $('b1').setStyle("background-image","url(images1/psychicUP.gif)");
    });
    $('b2').addEvent('mouseenter',function(){
        $('b2').setStyle("background-image","url(images1/questionsHO.gif)");
    });
    $('b2').addEvent('mouseleave',function(){
        $('b2').setStyle("background-image","url(images1/questionsUP.gif)");
    });
    $('b3').addEvent('mouseenter',function(){
        $('b3').setStyle("background-image","url(images1/opportunityHO.gif)");
    });
    $('b3').addEvent('mouseleave',function(){
        $('b3').setStyle("background-image","url(images1/opportunityUP.gif)");
    });
    $('b4').addEvent('mouseenter',function(){
        $('b4').setStyle("background-image","url(images1/glossaryHO.gif)");
    });
    $('b4').addEvent('mouseleave',function(){
        $('b4').setStyle("background-image","url(images1/glossaryUP.gif)");
    });
    $('b5').addEvent('mouseenter',function(){
        $('b5').setStyle("background-image","url(images1/testimHO.gif)");
    });
    $('b5').addEvent('mouseleave',function(){
        $('b5').setStyle("background-image","url(images1/testimUP.gif)");
    });
 /*   $('b6').addEvent('mouseenter',function(){
        $('b6').setStyle("background-image","url(images1/tarotHO.gif)");
    });
    $('b6').addEvent('mouseleave',function(){
        $('b6').setStyle("background-image","url(images1/tarotUP.gif)");
    });   */
    $('b7').addEvent('mouseenter',function(){
        $('b7').setStyle("background-image","url(images1/contactHO.gif)");
    });
    $('b7').addEvent('mouseleave',function(){
        $('b7').setStyle("background-image","url(images1/contactUP.gif)");
    });
    $('psychic_medium_smarthbox').addEvent('click', function(){
        window.location = "psychic_medium.php";
    });
    $('psychic_questions_smarthbox').addEvent('click', function(){
        window.location = "psychic_questions.php";
    });
    $('opportunity_knocks_smarthbox').addEvent('click', function(){
        window.location = "opportunity_knocks.php";
    });
    $('psychic_glossary_smarthbox').addEvent('click', function(){
        window.location = "psychic_glossary.php";
    });
    $('psychic_testimonials_smarthbox').addEvent('click', function(){
        window.location = "psychic_testimonials.php";
    });
    $('feed_back_smarthbox').addEvent('click', function(){
        window.location = "feed_back.php";
    });
	 $('luis').addEvent('click', function(){
        $('stella_test').setStyle('display', 'none');
        $('luis_test').setStyle('display', 'inline');
    });
    $('stella').addEvent('click', function(){
        $('luis_test').setStyle('display', 'none');
        $('stella_test').setStyle('display', 'inline');
    });
});
}
document.onload = start();