﻿var swapped = false;
var saved = false;

function checkForHtml(source, clientside_arguments)
{         
  if ((clientside_arguments.Value.indexOf("<") != -1) || (clientside_arguments.Value.indexOf(">") != -1))
  {
     clientside_arguments.IsValid=false;
  }
  else {clientside_arguments.IsValid=true};
}

function swapImage(imageID)
{   
    if(swapped == true)
    {
        var image = document.getElementById(imageID);
        image.src = images[imageID];
        swapped = false;
    }
    
    else
    {
        var image = document.getElementById(imageID);
        image.src = mouseOverImages[imageID];
        swapped = true; 
    }   
}

images = new Array();
images["imgHome"] = "images/menu/css_menu_home.jpg";
images["imgHistory"] = "images/menu/css_menu_history.jpg";
images["imgTheClan"] = "images/menu/css_menu_clan.jpg";
images["imgForum"] = "images/menu/css_menu_forum.jpg";
images["imgClanbaseInfo"] = "images/menu/css_menu_clanbase.jpg";
images["imgOurMaps"] = "images/menu/css_menu_maps.jpg";
images["imgLinks"] = "images/menu/css_menu_links.jpg";

mouseOverImages = new Array();
mouseOverImages["imgHome"] = "images/menu/css_menu_home_o.gif";
mouseOverImages["imgHistory"] = "images/menu/css_menu_history_o.gif";
mouseOverImages["imgTheClan"] = "images/menu/css_menu_clan_o.gif";
mouseOverImages["imgForum"] = "images/menu/css_menu_forum_o.gif";
mouseOverImages["imgClanbaseInfo"] = "images/menu/css_menu_clanbase_o.gif";
mouseOverImages["imgOurMaps"] = "images/menu/css_menu_maps_o.gif";
mouseOverImages["imgLinks"] = "images/menu/css_menu_links_o.gif";
 
function showFootage(footageURL, mapName)
{
    var cookie = document.cookie;
    var stylesheet;
    var height;
    
    if(cookie.length > 1)
    {
        if(cookie.indexOf("VC") != -1)
        {
            stylesheet = "App_Themes/VC_Theme/VC_Styles.css"
            height = 330;
        }
        
        else if(cookie.indexOf("CSS") != -1)
        {
           stylesheet = "App_Themes/CSS_Theme/CSS_Styles.css"
           height = 337; 
        } 
       
        else
        {
           stylesheet = "App_Themes/VC_Theme/VC_Styles.css"
           height = 330;
        }     
    }
    
    else
    {
        stylesheet = "App_Themes/VC_Theme/VC_Styles.css"
        height = 330;
    }
    
    var myWindow =  window.open('','mywindow','location=1,resizable=0,height=300,width=300,status=1,scrollbars=0');  
    myWindow.resizeTo(355,height);
    myWindow.document.open(); 
                                   
    myWindow.document.write("<html>"); 
    myWindow.document.write("<head>");
    myWindow.document.write("<link rel='stylesheet' type='text/css' href='" + stylesheet + "' />");                             
    myWindow.document.write("</head>");
    
    myWindow.document.write("<body>");
    myWindow.document.write("<div class='popupBox'>");
    myWindow.document.write("<div class='popupBoxHeader'>");
    myWindow.document.write("<h1>Minh " + mapName + "</h1>");
    myWindow.document.write("</div>");
    myWindow.document.write("<div id='videoContainer'>");
    myWindow.document.write("<embed src='" + footageURL + "' class='mapVideo' /><param name='movie'  class='mapVideo' value='" + footageURL + "' />");
    myWindow.document.write("</div>"); 
    myWindow.document.write("</div>");
    myWindow.document.write("<p style='float:right;'>");
    myWindow.document.write("Clip courtesy of Minh TV&reg");
    myWindow.document.write("</p>");   
    myWindow.document.write("</body>");
    myWindow.document.write("</html>");
    
    myWindow.document.close(); 
        myWindow.focus();                                   
}

function showProfile(clanMember)
{
    if(saved == true)
    {
        //close old profile
        document.getElementById("profileHeading" + oldClanMember).style.backgroundImage = "url('http://www.clanofminh.vcclan.net/minh/images/css/css_clan_member_bg2.jpg')";
        document.getElementById("profileHeading" + oldClanMember).style.color = "#C7CBE0";
        document.getElementById("panel" + oldClanMember).className = "profileContent";
        saved = false;
    }
    
    // open new one
    document.getElementById("profileHeading" + clanMember).style.backgroundImage = "url('http://www.clanofminh.vcclan.net/minh/images/css/css_clan_hover_bg.gif')";   
    document.getElementById("profileHeading" + clanMember).style.color = "white";   
    document.getElementById("panel" + clanMember).className = "showProfileContent";
    
    if(saved == false)
    {
        oldClanMember = clanMember;  
        saved = true;
    }

    window.location = "#" + clanMember;
    window.scrollBy(0,-50);       
}

function changeBackground(element, mouseover)
{
   if(mouseover == "in") 
   {
        element.style.color = "white";
        element.style.backgroundImage = "url('http://www.clanofminh.vcclan.net/minh/images/css/css_clan_hover_bg.gif')";
   }
   else
   {
        element.style.color = "#C7CBE0";
        element.style.backgroundImage = "url('http://www.clanofminh.vcclan.net/minh/images/css/css_clan_member_bg2.jpg')";     
   }   
}

function changeBackgroundColour()
{
    var cookie = document.cookie;
    var stylesheet;
    var height;
    
    if(cookie.length > 1)
    {
        if(cookie.indexOf("VC") != -1)
        {
            stylesheet = "App_Themes/VC_Theme/VC_Styles.css";
        }
        
        else if(cookie.indexOf("CSS") != -1)
        {
           stylesheet = "App_Themes/CSS_Theme/CSS_Styles.css";
        }   
        
        else
        {
             stylesheet = "App_Themes/COD4_Theme/COD4_Styles.css";      
        }
    }
    
    else
    {
        stylesheet = "App_Themes/VC_Theme/VC_Styles.css";
    }
    
    document.getElementById("stylesheet").href = stylesheet;
}