$(document).ready(function() {
    Cufon.replace('#menu li a', {hover: true});
	Cufon.replace('#boxes .box a', {hover: true});
	Cufon.replace('#boxes .box h2');
	Cufon.replace('#content h2');
	Cufon.replace('#content h3');
	Cufon.replace('#content h4');
	Cufon.replace('.boxDetails h2');
	Cufon.replace('.boxDetails h3');
	Cufon.replace('.boxDetails h4');
	Cufon.replace('#derslerMenu .dersler li a', {hover: true});
	Cufon.replace('#derslerMenu .siniflar li a', {hover: true});
	Cufon.replace('.cufonText', {hover: true});
	//Cufon.replace('#loginPanel label');  

	$(".imgBorder").corner("10px"); //Rounded Corners
	$(".imgBorderKdu").corner("10px"); //Rounded Corners
	$('#social-buttons').socialize();//Socialize Buttons
    
	$("#pageWrapper").show();
	
	$('#boxes .box').biggerlink(); //Main Page Make Clickable Div
	
	$("#box1 p").hover(function() {$(this).addClass("underline");}, function() {$(this).removeClass("underline");});
    $("#box2 p").hover(function() {$(this).addClass("underline");}, function() {$(this).removeClass("underline");});
    $("#box3 p").hover(function() {$(this).addClass("underline");}, function() {$(this).removeClass("underline");});
    $("#box4 p").hover(function() {$(this).addClass("underline");}, function() {$(this).removeClass("underline");});

    $("a.external").attr({target: "_blank"});// Open external links ... xhtml scrict doc type doesn't support target blank
    
	slightbox.initialize({find: 'slightbox',color: 'white',dir: '/scripts/simages'})
	// http://localhost/IlkogretimStatic/scripts/simages  // /scripts/simages 

	$(".box").setEqualHeight(); //Main Page Equal Box Height
	$(".box2").setEqualHeight(); //KDU Page Equal Box Height
	
});
// DOCUMENT READY END

function setWindowLocation(newLocation) {
        window.location = newLocation;
}

function setCurrentPage(newPage) {
    currentPage = newPage;
    SendDataToFlashMovie(newPage);
}

function getFlashMovieObject(movieName) {
    if (window.document[movieName]) {
        return window.document[movieName];
    }
    if (navigator.appName.indexOf("Microsoft Internet") == -1) {
        if (document.embeds && document.embeds[movieName])

            return document.embeds[movieName];
    } else
    // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
    {
        return document.getElementById(movieName);
    }
}

function SendDataToFlashMovie(newPage) {
    var flashMovie = getFlashMovieObject("anasayfa");

    flashMovie.sendTextToFlash(newPage);
}
var previousSelected = "";

function showDetail(selectedBox) {
    setCurrentPage(selectedBox);
    if (selectedBox != "boxes") {
        $(".box").fadeOut(100);

        if (previousSelected != "") {
            $("#" + previousSelected).fadeOut(500);
        }

        $("#" + selectedBox).fadeIn(500);

        previousSelected = selectedBox;
    } else {
        $(".boxDetails").fadeOut(100);

        $(".box").fadeIn(100);

    }

}

function scrollToDetails() {
    $('html, body').animate({
        scrollTop: $("#boxDetailsContainer").offset().top
    }, 1000);
}

function showDetail2(box2Details) {
	showDetail(box2Details);
	scrollToDetails();
}

var isWatchedEnterance = "";

function isMovieWatched() {
    return isWatchedEnterance;
}

function setMovieWatched() {
    if (isWatchedEnterance == "") {
        isWatchedEnterance = "watched";
    }
}
