﻿
function Main(colorVal)
{
    var strMenuId = "";
    var elemMenuId;
    elemMenuId = document.getElementById("inpPageName");
    if(elemMenuId)
    {
        strMenuId = "div" + elemMenuId.value;
        var elemMenuSelect;
        elemMenuSelect = document.getElementById(strMenuId);
        if(elemMenuSelect)
        {
            elemMenuSelect.style.backgroundColor = "#ffffff";
            elemMenuSelect.style.border = "1px solid #999999";
            elemMenuSelect.style.borderRight = "4px solid " + colorVal;
            elemMenuSelect.style.paddingRight = "3px";
        }
    }  
}

function Ent1(elem)
{
    elem.className = "divTPMenuLrgEnt";
}

function Lea1(elem)
{
    elem.className = "divTPMenuLrg";
}

function Ent2(elem)
{
    elem.className = "divTPMenuNmlEnt";
}

function Lea2(elem)
{
    elem.className = "divTPMenuNml";
}

function OpenWindowPopUp(url)
{
    var strHeightWidth = "";
    if ((screen.width>=1024) && (screen.height>=768))
    {
     strHeightWidth="height=768,width=1024,";
    }
    else
    {
      strHeightWidth="height=600,width=800,";
    }

    
    window.open(url, null, strHeightWidth+"status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=yes");
}

function ShowLargeImage(teamName)
	{
		// image is never going to larger than 640px wide
        var strHeightWidth = "height=600,width=730,";
        var strURL = "LargeImage.aspx?team=" + teamName;
        window.open(strURL, null, strHeightWidth+"status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=yes,left=100,top=100");
    }

function Temp()
{
    var strTemp;
    strTemp = "Coming soon";
    alert(strTemp);
}

// facebook script
function fbs_click()
{
    u=location.href;
    t=document.title;
    window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
    return false;
}

function InitialiseBlogFeed()
{
    var elemLoading = document.getElementById("pBlogLoading");
    if(!elemLoading)
    {
        return;
    }
    var elemLoaded = document.getElementById("ulBlogLoaded");
    if(!elemLoaded)
    {
        return;
    }
    
    
    // firefox
    if(!window.ActiveXObject)
    {
        return;
    }
    
    var feed = new google.feeds.Feed("http://webteams.blogspot.com/feeds/posts/default/");  
 	feed.setResultFormat(google.feeds.Feed.XML_FORMAT);
 	feed.load(function(result)
				{
					if (!result.error)
					{    
						var n = 0;
                        var nValid = 0;
                        var nLimit = 6; // the limit
                        var strHTML = "";
                        var xmlDoc = result.xmlDocument;
                        for (n=0;n<=xmlDoc.documentElement.childNodes.length-1;n=n+1) 
                        {  
							var elemEntry = xmlDoc.documentElement.childNodes.item(n);
							if(elemEntry.tagName=="entry")
							{
								//if(nValid<=nLimit)
								//{
									nValid = nValid + 1;
						    	var strTitle = elemEntry.selectSingleNode("title").text;
						    	var strLink = elemEntry.selectSingleNode("link[@rel='alternate']").getAttribute("href");
						    	var strPublished = elemEntry.selectSingleNode("published").text;	
						    	var strDateDisplay = strPublished.substring(8,10) + "/" + strPublished.substring(5,7)// + "/" + strPublished.substring(0,4)		    	
						    	strHTML = strHTML + "<li><a target=\"blank\" href=\"" + strLink + "\">" + strTitle + "</a> (" + strDateDisplay + ")</li>"
								//}
							}  
					    }
                        elemLoading.style.display = "none";
                        elemLoaded.style.display = "block";
		     	        elemLoaded.innerHTML = strHTML;    	
		     	        		
				       }	   	  
				       else
				       {
				        elemLoading.innerHTML = "";
				       }                                         
			})
	 	 	 
}

function ShowLargerPicture(value, wV, hV)
{
    var elemTeamPicture = document.getElementById("imgSiteHomePicture");
    if(elemTeamPicture)
    {
        elemTeamPicture.height = hV;
        elemTeamPicture.width = wV;
        elemTeamPicture.src = value;
        elemTeamPicture.style.cursor = "default";
        elemTeamPicture.title = "";
    }
    var elemCaption = document.getElementById("pSiteHomePicture");
    if(elemCaption)
    {
        elemCaption.style.width = wV;
    }
}