$(document).ready(function()
{
    bindEvents();

});



function bindEvents()
{    



    $("#carFeaturedEventsBtn").mouseover(function(e)
    {
        $("#carFeaturedEventsBtn").attr("src", "/images/EUfeaturedEventsBlack.png");
    });
    $("#carFeaturedEventsBtn").mouseout(function(e)
    {
        $("#carFeaturedEventsBtn").attr("src", "/images/EUfeaturedEventsBlue.png");
    });

//    $("#westFeaturedEventsBtn").mouseover(function(e)
//    {
//        $("#westFeaturedEventsBtn").attr("src", "/images/EUonTheCalendarBlack.png");
//    });

//    $("#westFeaturedEventsBtn").mouseout(function(e)
//    {
//        $("#westFeaturedEventsBtn").attr("src", "/images/EUfeaturedEventsBlue.png");
//    });
    
    

    $("#wsFeaturedEventsBtn").mouseover(function(e)
    {
        $("#wsFeaturedEventsBtn").attr("src", "/images/EUfeaturedEventsBlack.png");
    });

    $("#wsFeaturedEventsBtn").mouseout(function(e)
    {
        $("#wsFeaturedEventsBtn").attr("src", "/images/EUfeaturedEventsBlue.png");
    });
    
    
    
    $("#carmelOnTheCalendarsBtn").mouseover(function(e)
    {
        $("#carmelOnTheCalendarsBtn").attr("src", "/images/EUonTheCalendarBlack.png");
    });


    $("#carmelOnTheCalendarsBtn").mouseout(function(e)
    {
        $("#carmelOnTheCalendarsBtn").attr("src", "/images/EUonTheCalendarBlue.png");
    });


    $("#westOnTheCalendarsBtn").mouseover(function(e)
    {
        $("#westOnTheCalendarsBtn").attr("src", "/images/EUonTheCalendarBlack.png");
    });

    $("#westOnTheCalendarsBtn").mouseout(function(e)
    {
        $("#westOnTheCalendarsBtn").attr("src", "/images/EUonTheCalendarBlue.png");
    });

    
    
    $("#westOnTheCalendarsBtn").click(function(e)
    {
        document.location = "wlevents";
    });
    

     $("#carmelOnTheCalendarsBtn").click(function(e)
    {
        document.location = "events";
    });

    $("#wsFeaturedEventsBtn").click(function(e)
    {
        document.location = "west_featured";
    });


    $("#carFeaturedEventsBtn").click(function(e)
    {
        document.location = "carmel_featured";
    });

    if ($("#theform").length > 0)
    {
        $("#theform").submit(function()
        {
            $(this).ajaxSubmit($("#submitResponse").show());
            return false;
        });
    }

}


function openURL(url)
{
    window.open(url);
}


function openF1Registration(url)
{
    var ScreenWidth = window.screen.width;
    var ScreenHeight = window.screen.height;
    var movefromedge = 0;
    placementx = (ScreenWidth / 2) - ((760) / 2);
    placementy = (ScreenHeight / 2) - ((650 + 50) / 2);

    //document.location = document.location;
    window.open(url, "f1window", "height=650,width=760,resizeable=1,scrollbars=1,menubar=0,toolbar=0,status=0,location=0,left=" + placementx + ",top=" + placementy + ",screenX=" + placementx + ",screenY=" + placementy);


}

function openGnRegistration(url)
{
    var ScreenWidth = window.screen.width;
    var ScreenHeight = window.screen.height;
    var movefromedge = 0;
    placementx = (ScreenWidth / 2) - ((1000) / 2);
    placementy = (ScreenHeight / 2) - ((650 + 50) / 2);

    //document.location = document.location;
    window.open(url, "f1window", "height=650,width=1000,resizeable=1,scrollbars=1,menubar=0,toolbar=0,status=0,location=0,left=" + placementx + ",top=" + placementy + ",screenX=" + placementx + ",screenY=" + placementy);
}


function hideSidebar()
{
    $("#sidebar").css("display", "none");
	$("#storyPromoDiv").css("display", "none");
	$("#middleStoryDiv").css("padding-left", "170px");
}


function noShare()
{
    $("#shareDIV").css("display", "none");
	$(".addthis_toolbox").css("display", "none");
}


function noPromos()
{
	$("#middleDiv").css("padding-left", "170px");
	$("#promoDiv").css("display", "none");
}

function pageWide()
{
    //if ($("#mainTextArea")) { $("#mainTextArea").css("width", "800px") };
    //if ($("#sidebar")) { $("#sidebar").css("display", "none") };
    //if ($("#storyPromoDiv")) { $("#storyPromoDiv").css("display", "none") };
	//$("#sidebar").css("display", "none");
	$("#storyPromoDiv").css("display", "none");
	$("#mainTextArea").css("width", "800px");

}



function overRideForSidebar()
{
    $("#sidebarOverride").css("display", "block");
    $("#sidebar").css("display", "none");
}


if (window.name != "pod") 
{
    window.name = "main";
}



function makeStateSelectOptions(target)
{
    var tmpStateList;
    var tmpReturnString;
    var tmpStateArray;
    var i;
    var selectFlag;

    var tmpStateList = "AL|AK|AZ|AR|CA|CO|CT|DC|DE|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY"
    tmpReturnString = tmpReturnString + "<option value=''>&#160;</option>"
    tmpStateArray = tmpStateList.split("|");
    tmpReturnString = '<select id="' + target + '_state" name="' + target + '_state">'

    for (i = 0; i < tmpStateArray.length; i++)
    {
        tmpReturnString = tmpReturnString + "<option value='" + tmpStateArray[i] + "'>" + tmpStateArray[i] + "</option>"
    }
    tmpReturnString = tmpReturnString + "</select>"
    document.getElementById(target).innerHTML = tmpReturnString;
}

//$(document).ready(function()
//{
//    $("#pageButton-1").addClass("pageButtonRoll");
//});

var prevDiv = "#pageDiv-1";
var prevButton = "#pageButton-1";


function swapPage(objID)
{
    var divIndex = objID.charAt(objID.length - 1);
    var obj = "#pageDiv-" + divIndex;
    var button = "#pageButton-" + divIndex;

    $(obj).css("display", "block");
    $(button).addClass("pageButtonRoll");


    if (obj != prevDiv)
    {
        $(prevDiv).css("display", "none");
        $(prevButton).removeClass("pageButtonRoll");
    }

    prevButton = "#pageButton-" + divIndex;
    prevDiv = "#pageDiv-" + divIndex;
}




var campusSelectState = "closed";
function openCampusSelect()
{
    if (campusSelectState == "closed")
    {
        $("#campusSelectDiv").slideDown("slow");
        campusSelectState = "open";
    }
    else
    {
        $("#campusSelectDiv").slideUp("slow");
        campusSelectState = "closed";
    }
}

function showHomeStory(id)
{
    $.ajax({
        type: "POST",
        url: "/retrieval/getHomeStory.aspx",
        cache: false,
        data: "&id=" + id,
        success: function(data)
        {
            $("#homeStoryDiv").html(data);
            $("#homeStoryDiv").show();
        }
    });
}

function hideHomeStory()
{
    $("#homeStoryDiv").hide();
    $("#homeStoryDiv").html("");
}



function tmpPopup(url) 
{
    window.open(url, null, "height=600,width=800,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

function openContact(url)
{

    window.open(url, "Contact", "height=650,width=760,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
}




function setConsoleInfo(pageid) 
{
    //alert("called");
    //window.parent.document.getElementById("hdncurrentlocation").value = "";
    window.parent.currentLocation = "";
	
	
	window.parent.document.getElementById("curidspan").innerHTML = pageid;
	//window.parent.document.getElementById("currpageid").value = pageid;
	window.parent.currpageid = pageid;

}


function doRo(item)
{
    if (document.all)
    {
//        var itemID = "#" + $(item).attr("id");
//        $(itemID).fadeOut("fast");
//        $(itemID).fadeIn("fast");
    }
    else
    {
        cvi_corner.modify(item.firstChild.firstChild, { filter: [{ f: 'gamma', s: 1.3}] });
    }

}

function doRout(item)
{
    if (document.all)
    {
       //$(item).animate({ opacity: 1.0 }, 150)

    }
    else
    {
        cvi_corner.modify(item.firstChild.firstChild, { filter: [{ f: 'none'}] })
    }

}

function doRo2(item)
{
    // $(item).animate({ opacity: 0.5 }, 150)
    //$(item).animate({ opacity: 1.0 }, 150)

    cvi_corner.modify(item.firstChild.firstChild.firstChild, { filter: [{ f: 'gamma', s: 1.3}] });
}

function doRout2(item)
{
    cvi_corner.modify(item.firstChild.firstChild.firstChild, { filter: [{ f: 'none'}] })
}




function doChRo(item)
{
    $(item).animate({ opacity: 0.5, filter:''}, 150)
    //cvi_corner.modify(item.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild, { filter: [{ f: 'gamma', s: 1.3}] });
    $(item).animate({ opacity: 1.0, filter:''}, 150)

}



function doChRout(item)
{
    //cvi_corner.modify(item.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild, { filter: [{ f: 'none'}] });
}


function doListRo(item)
{
    cvi_corner.modify(item.firstChild, { filter: [{ f: 'gamma', s: 1.3}] });
}

function doListRout(item)
{
    cvi_corner.modify(item.firstChild, { filter: [{ f: 'none'}] });
}

//var openLandingThumb = null;
function doLandingRO(item)
{
    var bottomStop = -28;
    var targetItem = $(item).find(".landingPromoPopUp");
    var popY = (targetItem.height() + bottomStop) * -1;

    targetItem.css("top", popY);
    targetItem.show();
	
}

function doLandingRout(item)
{        

    $(item).find(".landingPromoPopUp").hide();

}   



function doArrowRo(item)
{
    if ($(item).attr("id") == "leftArrow")
    {
        if ($(item).attr("src") == "images/leftArrowScroll.png")
        {
            $(item).attr("src", "images/leftArrowScroll2.png")
        }
        else
        {
            $(item).attr("src", "images/leftArrowScroll.png")
        }
    }

    if ($(item).attr("id") == "rightArrow")
    {
        if ($(item).attr("src") == "images/rightArrowScroll.png")
        {
            $(item).attr("src", "images/rightArrowScroll2.png")
        }
        else
        {
            $(item).attr("src", "images/rightArrowScroll.png")
        }
    }

}

function doCapstoneArrowRo(item)
{
    if ($(item).attr("id") == "leftArrow")
    {
        if ($(item).attr("src") == "images/capleftArrowScroll.png")
        {
            $(item).attr("src", "images/capleftArrowScroll2.png")
        }
        else
        {
            $(item).attr("src", "images/capleftArrowScroll.png")
        }
    }

    if ($(item).attr("id") == "rightArrow")
    {
        if ($(item).attr("src") == "images/caprightArrowScroll.png")
        {
            $(item).attr("src", "images/caprightArrowScroll2.png")
        }
        else
        {
            $(item).attr("src", "images/caprightArrowScroll.png")
        }
    }

}


function doTopArrowRo(item)
{
    if ($(item).attr("id") == "topArrowLeft")
    {
        if ($(item).attr("src") == "images/slideLeft.png")
        {
            $(item).attr("src", "images/slideLeft2.png")
        }
        else
        {
            $(item).attr("src", "images/slideLeft.png")
        }
    }

    if ($(item).attr("id") == "topArrowRight")
    {
        if ($(item).attr("src") == "images/slideRight.png")
        {
            $(item).attr("src", "images/slideRight2.png")
        }
        else
        {
            $(item).attr("src", "images/slideRight.png")
        }
    }

}
//TODO: this exist in functions and in main console functions
var tmpLastElement = "";
function makeActive(tmpElement) {

    window.parent.currentLocation = tmpElement;
  
    
    tmpLocationArray = tmpElement.split("_")
    tmpElementID = tmpLocationArray[2];
    tmpStoryID = tmpLocationArray[1];

    if (window.parent.editMode == true)
    {
        if (tmpLastElement != "") {
            //alert("last Element = " + tmpLastElement)
            document.getElementById(tmpLastElement).style.backgroundColor = "";
            $("." + tmpLastElement).css("backgroundColor", "");
        }
        tmpLastElement = tmpElement;
        document.getElementById(tmpElement).style.backgroundColor = "#ffcc00";
        $("." + tmpElement).css("backgroundColor", "#ffcc00");
        
        //alert(tmpElement);
       // alert(document.getElementById(tmpElement).style.backgroundColor);

        window.parent.currStoryId = tmpStoryID;


        window.parent.activeIndicator = tmpElementID;
        
    }
}





function openBlog(item)
{
    itemToOpen = "blogOpen" + item;
    itemToClose = "blogEntry" + item;

    for (i = 0; i < 5; i++)
    {
        document.getElementById("blogOpen" + i).style.display = "none";
        document.getElementById("blogEntry" + i).style.display = "block";
    }

    // alert(item);
    document.getElementById(itemToClose).style.display = "none";
    document.getElementById(itemToOpen).style.display = "block";
}

//	$(function() {
//		$("#tabs").tabs({
//			event: 'mouseover'
//		});
//	});



function toggleDiv(div)
{
    $("#"+div).toggle("fast");
}

function toggleSeries(id)
{
    if ($("#button_" + id).attr("src") == "/images/misc/sermons" + id + ".gif")
    {
        $("#button_" + id).attr("src", "/images/misc/sermons" + id + "_b.gif");
    }
    
    else
    {
        $("#button_" + id).attr("src", "/images/misc/sermons" + id + ".gif");
    }
    
    $("#week" + id).toggle("fast");
}

var currentNavState = "closed";
function toggleMinistriesNav(div)
{
    //$("#campusSelectDiv").toggle("blind", 200)
    if (currentNavState == "closed")
    {
        $("#campusSelectDiv").slideDown("fast")
        $("#ministriesNavButton").attr("src", "/images/minListBtn2.png");
        currentNavState = "open";
    }
    else
    {
        $("#campusSelectDiv").slideUp("fast")
        $("#ministriesNavButton").attr("src", "/images/minListBtn.png");
        currentNavState = "closed";
    }
}




//Moved to core.js
function swapFrame(url,tmpCurrTemplateID)
{
	window.location = url;
}


var prevItem;
function swapRotatorText(i) {
    $(prevItem).fadeOut("slow");
    $("#rotator" + i).fadeIn("slow");
    
    prevItem = "#rotator" + i;
}


var prevPodItem = "#pod1";
function swapPod(i) {
    var item = "#pod" + i;
    $(prevPodItem).fadeOut("slow");
    $(item).fadeIn("slow");

    prevPodItem = item;
}



var prevHomeItem = 0;
function swapHomeContent(id) {

    $(prevHomeItem).fadeOut("slow");
    $("#page" + id).fadeIn("slow");

    prevHomeItem = "#page" + id;
}

setInterval(swapSocialTray, 10000);

var currentSocial = 1;
function swapSocialTray()
{
    switch (currentSocial)
    {
        case 1:
        {
            $("#socialOne").fadeIn("slow");
            $("#socialTwo").css("display", "none");
            $("#socialThree").css("display", "none");
            currentSocial = 2;
            break;
        }
    case 2:
        {
            $("#socialTwo").fadeIn("slow");
            $("#socialOne").css("display", "none");
            $("#socialThree").css("display", "none");

            if ($("#socialThree").length > 0)
            {
                currentSocial = 3;
            }
            else
            {
                currentSocial = 1;
            }

            break;
        }
        case 3:
        {
            $("#socialThree").fadeIn("slow");
            $("#socialTwo").css("display", "none");
            $("#socialOne").css("display", "none");
            currentSocial = 1;
            break;
        }
        
    }
}


function swapHomeDiv(id) {
    var obj = "page" + id;

    document.getElementById("homeMain").style.display = "block";

    if (prevHomeItem != "#page" + id) {
        document.getElementById("page0").style.display = "none";
        document.getElementById("page1").style.display = "none";
        document.getElementById("page2").style.display = "none";

        swapHomeContent(id);
    }

}

function hideHomeContent() {

    if (prevHomeItem != 0) {
        var item = prevHomeItem.replace("#", "");
        document.getElementById(item).style.display = "none";
        document.getElementById("homeMain").style.display = "none";
        //document.getElementById("page1").style.display = "none";
        //document.getElementById("page2").style.display = "none";
        prevHomeItem = 0;
    }
}


//Moved to core.js
function openEvite(id)
{
    var ScreenWidth=window.screen.width;
    var ScreenHeight=window.screen.height;	
    var movefromedge=0;
    placementx=(ScreenWidth/2)-((640)/2);
    placementy=(ScreenHeight/2)-((640+50)/2);
    var PopUpUrl= "evite.aspx?storyid=" + id

	window.open(PopUpUrl,"","width=640,height=640,toolbar=0,location=0,directories=0,status=0,scrollbars=0,menubar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+placementx+",screenY="+placementy+",");
}


function sendPageLink(headline)
{
	tmpURL = "includes/sendPageLink.asp?pageID=" + document.getElementById("currentpageid").value;
	window.open(tmpURL, null, "height=600,width=800,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

function printPage()
{
	tmpURL = "print.asp?storyid=" + document.getElementById("currentstoryid").value;
	window.open(tmpURL, "null", "height=800,width=630,status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,scrollbars=yes");
}

function sendHomeLink(headline)
{
	tmpURL = "sendHomeLink.asp?pageID=" + document.getElementById("currentpageid").value;
	window.open(tmpURL, null, "height=600,width=800,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

function sendStoryLink()
{
	tmpURL = "includes/sendStoryLink.asp?storyid=" + document.getElementById("currentstoryid").value;
	window.open(tmpURL, null, "height=600,width=800,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

function getEventList(pageid, source)
{
    $.ajax({
        url: "/retrieval/getEventList.aspx?pageid=" + pageid + "&source=" + source,
        cache: false,
        success: function(html) {
            $("#mainText").html(html);
            
        }
    });
}

function getGroupsList(pageid, source)
{
    $.ajax({
        url: "/retrieval/getGroupsList.aspx?pageid=" + pageid + "&source=" + source,
        cache: false,
        success: function(html)
        {
            $("#mainTextArea").html(html);
        }
    });
}


function showGroupItem(item)
{
    $("#" + item).toggle("blind", "fast");
    var itemSplit = item.split("_");

    if ($("#openFlag_" + itemSplit[1]).attr("src") == "/images/groupsListPlus.gif")
    {
        $("#openFlag_" + itemSplit[1]).attr("src", "/images/groupsListMinus.gif");

        //var headerID = item.replace("item", "group");
        //$("#" + headerID).parent().scrollTo("#" + headerID, 800);
    }
    else
    {
        $("#openFlag_" + itemSplit[1]).attr("src", "/images/groupsListPlus.gif");
    }

}




function openItem(id)
{

    if (itemOpen != id)
    {
        $("#mainText").accordion("activate", $("#" + id))
    }
    itemOpen = id;

}



//--------------------
function showGallery(id)
{
    $.ajax({
        url: "/retrieval/getGallery.aspx?gid=" + id,
        cache: false,
        success: function(html)
        {
            $("#gallery").html(html);
            $("a[rel^='prettyPhoto']").prettyPhoto();
        }
    });
}




function closeGallery()
{
    $("#galleryFrame").hide();
	//document.getElementById("galleryFrame").style.display = "none";
}


//--------------------

function showModal()
{
    $("#contact-container").modal({ onOpen: function(dialog)
    {
        dialog.overlay.fadeIn('fast', function()
        {
            dialog.container.fadeIn('fast', function()
            {
                dialog.data.fadeIn('fast');
            });
        });
    }
    });
}

function hideModal()
{
    $("#contact-container").modal({ onClose: function(dialog)
    {
        dialog.data.slideUp('slow', function()
        {
            dialog.container.slideUp('slow', function()
            {
                dialog.overlay.fadeOut('slow', function()
                {
                    $.modal.close(); // must call this!
                });
            });
        });
    }
    });

}



//------------------------

function resizeVidDiv(newHeight)
{
    $("#mainImagePlayer").animate({ height: newHeight }, $("#mainImagePlayer").css("height"));
}


function shrinkVidDiv()
{
    $("#mainImagePlayer").animate({ height: 290 }, $("#mainImagePlayer").css("height"));
}


function writeNewVideo(file, lcid)
{
    ip = document.getElementById("hdnip").value;
    image = document.getElementById("hdnvidimage").value;
    file = "/images/flvvideo/" + file

    var flashObject = '<object id="flvVideo" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"  width="640" height="480" >'
	+ '          <param name="movie" value="/flash/mainImagePlayer.swf?video=' + file + '&lcid=' + lcid + '&ip=' + ip + '&image=' + image + '&playflag=play" />'
	+ '          <param name="quality" value="high" />'
	+ '          <param name="allowFullScreen" value="true" />'
	+ '      	 <param name="wmode" value="transparent" />'
	+ '          <embed src="/flash/mainImagePlayer.swf?video=' + file + '&lcid=' + lcid + '&ip=' + ip + '&image=' + image + '&playflag=play" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"  allowFullScreen="true" width="640" height="480" wmode="transparent"></embed>'
	+ '          </object>'

    $("#mainImagePlayer").html(flashObject);
    document.getElementById("header").scrollIntoView();

}

function writeNewHomeVideo(file, lcid)
{
    ip = document.getElementById("hdnip").value;
    image = "";
    file = "/images/flvvideo/" + file

    var flashObject = '<object id="flvVideo" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"  width="640" height="480" >'
	+ '          <param name="movie" value="/flash/mainImagePlayer.swf?video=' + file + '&lcid=' + lcid + '&ip=' + ip + '&image=' + image + '&playflag=play" />'
	+ '          <param name="quality" value="high" />'
	+ '          <param name="allowFullScreen" value="true" />'
	+ '      	 <param name="wmode" value="transparent" />'
	+ '          <embed src="/flash/mainImagePlayer.swf?video=' + file + '&lcid=' + lcid + '&ip=' + ip + '&image=' + image + '&playflag=play" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"  allowFullScreen="true" width="640" height="480" wmode="transparent"></embed>'
	+ '          </object>'

   showModal();
    $("#homeVideoPlayer").html(flashObject);

    
    
    //$("#homeVideoPlayer").show();
    //$("#homeVideoClose").show();
}

function resetHomeDiv()
{
    hideModal();    
    $("#homeVideoPlayer").html("");


    //$("#homeVideoPlayer").hide();
   // $("#homeVideoClose").hide();

}



function resetVidDiv()
{
    shrinkVidDiv();

    lcid = $("#hdnlcid").val();
    ip = $("#hdnip").val();
    image = $("#hdnvidimage").val();
    file = $("#hdnvidfile").val();

    var flashObject = '<object id="flvVideo" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="640" height="480" >'
	+ '          <param name="movie" value="/flash/mainImagePlayer.swf?video=' + file + '&lcid=' + lcid + '&ip=' + ip + '&image=' + image + '&playflag=" />'
	+ '          <param name="quality" value="high" />'
	+ '      	 <param name="wmode" value="transparent" />'
	+ '          <embed src="/flash/mainImagePlayer.swf?video=' + file + '&lcid=' + lcid + '&ip=' + ip + '&image=' + image + '&playflag=" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="640" height="480" wmode="transparent"></embed>'
	+ '          </object>'
    
    $("#mainImagePlayer").html(flashObject);

}		
		

function writeMP3(file, title)
{

    var flashObject = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="250" height="120">'
	+ '    <param name="movie" value="/flash/mp3player.swf?file=' + file + "&title=" + title + '" />'
	+ '    <param name="quality" value="high" />'
	+ '    <param name="wmode" value="transparent" />'
	+ '    <embed src="/flash/mp3player.swf?file=' + file + "&title=" + title + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"  width="250" height="120" wmode="transparent"></embed>'
	+ '    </object>'

    $("#mp3Div").css("display", "block");
    $("#mp3Div").html(flashObject);
}

function closeMp3()
{
    $("#mp3Div").css("display", "none");
}


function closeMap()
{
	document.getElementById("mapDiv").style.display = "none";
}

function openMap()
{
	document.getElementById("mapDiv").style.display = "block";
}


function openMe (url) 
{

    window.open(url);
}


function openSame (url) 
{

    window.location.href = (url);
}








