﻿
//Function that allows only numerics to be entered in a textbox
function numericOnly()
{	
	if((window.event.keyCode > 47 && window.event.keyCode < 58)||(window.event.keyCode == 8) || (window.event.keyCode == 9) || (window.event.keyCode == 32))
	{
        return true;
    }
    else
    {
		window.event.returnValue = false;
	    return false;
    }
}

//Functio to preload specifc Images
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//Function to Show Recipient details
function ShowRecipientDetails()
{
    document.getElementById("trDynamic").style.display="none";
    document.getElementById("trRecipientDetails").style.display="";
    document.getElementById("tbBuzzedBy").style.display="none";
    document.getElementById("trSuccessMessage").style.display="none";
    document.getElementById("trDelayedSuccessMessage").style.display="none"; //#4009 
    document.getElementById("trSenderDetails").style.display="none"; 
    document.getElementById("tblOrderButtons").style.display="none"; 
    document.getElementById("tblRecipientPanelButtons").style.display="";
    document.getElementById("trInitial").style.display="none"; 
    document.getElementById("trLoggedIn").style.display="none"; 

}
//Show RecipientDetails Logging After Selectign the Buzzcast   //###2873 veeru
function ShowRecipientDetails1(txtbuzzname)
{
    
    document.getElementById("trDynamic").style.display="none";
    document.getElementById("trRecipientDetails").style.display="";
    document.getElementById("ctl00_ContentPlaceHolder1_txtSenderName").value = txtbuzzname; //###2873 veeru
    document.getElementById("tbBuzzedBy").style.display="none";
    document.getElementById("trSuccessMessage").style.display="none";
    document.getElementById("trDelayedSuccessMessage").style.display="none"; //#4009 
    document.getElementById("trSenderDetails").style.display="none"; 
    document.getElementById("tblOrderButtons").style.display="none"; 
    document.getElementById("tblRecipientPanelButtons").style.display="";
    document.getElementById("trInitial").style.display="none"; 
    document.getElementById("trLoggedIn").style.display="none";  
}

//Function to Show Personalisation Options
function ShowDynamicPanel()
{
    document.getElementById("tblOrderButtons").style.display="";
    document.getElementById("trDynamic").style.display=""; 
    document.getElementById("tbBuzzedBy").style.display="none";
    document.getElementById("trSuccessMessage").style.display="none";
    document.getElementById("trDelayedSuccessMessage").style.display="none"; //#4009 
    document.getElementById("tblRecipientPanelButtons").style.display="none"; 
    scroll(0,0);
}

//Function to Show Success Message after billing is done.//#4009 added condition as per delayed send options
function ShowOrderSuccessMessage()
{
    //#4009
   if (document.getElementById("ctl00_ContentPlaceHolder1_HdnFieldIsdelayedSend").value == "N")
    {
    document.getElementById("trSuccessMessage").style.display="";    
    document.getElementById("trDelayedSuccessMessage").style.display="none";  
	}
   else if(document.getElementById("ctl00_ContentPlaceHolder1_HdnFieldIsdelayedSend").value == "Y")
	{
	 var delayedsendtime; 
	 var successmsg;	 
	 if(document.getElementById("ctl00_ContentPlaceHolder1_DDLDeliveryTime").value == 1)
	   delayedsendtime = "morning"
	 else if (document.getElementById("ctl00_ContentPlaceHolder1_DDLDeliveryTime").value == 2)
	   delayedsendtime = "afternoon"
	 else
	   delayedsendtime = "evening"
	successmsg = delayedsendtime + " of " + document.getElementById("ctl00_ContentPlaceHolder1_txtDeliveryDate").value;	
	document.getElementById("ctl00_ContentPlaceHolder1_lblDelayedSuccessMsg").innerHTML +=  successmsg;
	document.getElementById("trDelayedSuccessMessage").style.display="";  
	document.getElementById("trSuccessMessage").style.display="none";    
	}
	
    document.getElementById("trDynamic").style.display="none";
    document.getElementById("trSenderDetails").style.display="none";
    document.getElementById("tbBuzzedBy").style.display="none";
    document.getElementById("trRecipientDetails").style.display="none"; 
    document.getElementById("tblOrderButtons").style.display="none"; 
    document.getElementById("tblRecipientPanelButtons").style.display="none";
    document.getElementById("trInitial").style.display="none"; 
    document.getElementById("trLoggedIn").style.display="none"; 
    hideTooltip();
	hideAlternatetooltip();
}

//Function to show have me options for registered user
function ShowRegisteredHaveMeOptions(type)
{
     document.getElementById("trSenderDetails").style.display=""; 
     if(type=='0') //Free card
          document.getElementById("trPaymentOptions").style.display="none";
     else if(type=='1') //Paid card: Always ask
        document.getElementById("trPaymentOptions").style.display="";
    else if(type=='2') //Paid card: Bill to mobile/credit card
        document.getElementById("trPaymentOptions").style.display="none";
    document.getElementById("trUnregisteredDetails").style.display="none";
    document.getElementById("trTip").style.display="none";
    document.getElementById("trHaveMeDetails").style.display="";
    document.getElementById("trDynamic").style.display="none";
    document.getElementById("trRecipientDetails").style.display="none";
    document.getElementById("tbBuzzedBy").style.display="none";
    document.getElementById("trSuccessMessage").style.display="none";
    document.getElementById("trDelayedSuccessMessage").style.display="none"; //#4009
    document.getElementById("tblOrderButtons").style.display="none"; 
    document.getElementById("tblRecipientPanelButtons").style.display="none"; 
    document.getElementById("trInitial").style.display="none"; 
    document.getElementById("trLoggedIn").style.display="none";  
}

//Function to show sender options for unregistered user
function ShowUnregisteredSendMeOptions(type)
{
    document.getElementById("trSenderDetails").style.display=""; 
    if(type=='0') //Priced card 
    { 
        document.getElementById("trPaymentOptions").style.display="";
        document.getElementById("trUnregisteredDetails").style.display="none";
        document.getElementById("trTip").style.display="none";
    }
    else //Free card
    { 
        document.getElementById("trPaymentOptions").style.display="none";
        document.getElementById("trUnregisteredDetails").style.display="";
        document.getElementById("trTip").style.display="none";
    }
    document.getElementById("trHaveMeDetails").style.display="none";
    document.getElementById("trDynamic").style.display="none";
    document.getElementById("trRecipientDetails").style.display="none";
    document.getElementById("tbBuzzedBy").style.display="none";
    document.getElementById("trSuccessMessage").style.display="none";
    document.getElementById("trDelayedSuccessMessage").style.display="none"; //#4009
    document.getElementById("tblOrderButtons").style.display="none"; 
    document.getElementById("tblRecipientPanelButtons").style.display="none"; 
    document.getElementById("trInitial").style.display="none"; 
    document.getElementById("trLoggedIn").style.display="none";
}

//#4009
function ShowFreeCardDelayedSendOptions()
{
    document.getElementById("trSenderDetails").style.display=""; 
    
    document.getElementById("trPaymentOptions").style.display="none";
    document.getElementById("trUnregisteredDetails").style.display="none";
    document.getElementById("trTip").style.display="none";
    document.getElementById("trDelayedSendOptions").style.display=""; 
    
//    document.getElementById("ctl00_ContentPlaceHolder1_txtDeliveryDate").value ="";    //to set default values for delay controls
//    document.getElementById("ctl00_ContentPlaceHolder1_DDLDeliveryTime").value = 1;
            
    
    document.getElementById("trHaveMeDetails").style.display="none";
    document.getElementById("trDynamic").style.display="none";
    document.getElementById("trRecipientDetails").style.display="none";
    document.getElementById("tbBuzzedBy").style.display="none";
    document.getElementById("trSuccessMessage").style.display="none";
    document.getElementById("trDelayedSuccessMessage").style.display="none"; //#4009
    document.getElementById("tblOrderButtons").style.display="none"; 
    document.getElementById("tblRecipientPanelButtons").style.display="none"; 
    document.getElementById("trInitial").style.display="none"; 
    document.getElementById("trLoggedIn").style.display="none";    
}

function ShowUnregisteredHaveMeOptions()
{
    document.getElementById("trSenderDetails").style.display=""; 
    if(document.getElementById("ctl00_ContentPlaceHolder1_hdnHiddenPr").value!='0.00')
    { 
        document.getElementById("trPaymentOptions").style.display="";
        document.getElementById("trTip").style.display="";
    }
    else
    { 
        document.getElementById("trPaymentOptions").style.display="none";
        document.getElementById("trTip").style.display="none";
    }
    document.getElementById("trUnregisteredDetails").style.display="none";
    document.getElementById("trHaveMeDetails").style.display="";
    document.getElementById("trDynamic").style.display="none";
    document.getElementById("trRecipientDetails").style.display="none";
    document.getElementById("tbBuzzedBy").style.display="none";
    document.getElementById("trSuccessMessage").style.display="none";
    document.getElementById("trDelayedSuccessMessage").style.display="none"; //#4009
    document.getElementById("tblOrderButtons").style.display="none"; 
    document.getElementById("tblRecipientPanelButtons").style.display="none";
    document.getElementById("trInitial").style.display="none"; 
    document.getElementById("trLoggedIn").style.display="none"; 
}

//Function to show dynamic panel when back button is clicked on recipient details page
function RecipientDetailsBack()
{
    document.getElementById("trDynamic").style.display="";
    document.getElementById("trRecipientDetails").style.display="none";
    document.getElementById("tbBuzzedBy").style.display="none";
    document.getElementById("trSuccessMessage").style.display="none";
    document.getElementById("trDelayedSuccessMessage").style.display="none"; //#4009
    document.getElementById("trSenderDetails").style.display="none"; 
    document.getElementById("tblOrderButtons").style.display=""; 
    document.getElementById("tblRecipientPanelButtons").style.display="none"; 
}

//Function to show dynamic panel/recipient detais pag when back button is clicked on sender details page
function SenderDetailsBack()
{
    document.getElementById("trSenderDetails").style.display="none"; 
    document.getElementById("trPaymentOptions").style.display="none";
    document.getElementById("trUnregisteredDetails").style.display="none";
    document.getElementById("trTip").style.display="none";
    document.getElementById("trHaveMeDetails").style.display="none";
    document.getElementById("tbBuzzedBy").style.display="none";
    document.getElementById("trSuccessMessage").style.display="none";
    document.getElementById("trDelayedSuccessMessage").style.display="none"; //#4009
   if((document.getElementById("ctl00_ContentPlaceHolder1_hdnSendType").value=="RegisteredSendMe")||(document.getElementById("ctl00_ContentPlaceHolder1_hdnSendType").value=="UnregisteredSendMe"))
   { 
        document.getElementById("trDynamic").style.display="none";
        document.getElementById("trRecipientDetails").style.display="";
        document.getElementById("tblOrderButtons").style.display="none"; 
        document.getElementById("tblRecipientPanelButtons").style.display=""; 
   }
   else if((document.getElementById("ctl00_ContentPlaceHolder1_hdnSendType").value=="RegisteredHaveMe")||(document.getElementById("ctl00_ContentPlaceHolder1_hdnSendType").value=="UnregisteredHaveMe"))
   {
        document.getElementById("trDynamic").style.display="";
        document.getElementById("trRecipientDetails").style.display="none";
        document.getElementById("tblOrderButtons").style.display=""; 
        document.getElementById("tblRecipientPanelButtons").style.display="none"; 
   }
   removeSuggestions();
}

function SendMeAgain()
{
    document.getElementById("trSenderDetails").style.display="none"; 
    document.getElementById("trPaymentOptions").style.display="none";
    document.getElementById("trUnregisteredDetails").style.display="none";
    document.getElementById("trTip").style.display="none";
    document.getElementById("trHaveMeDetails").style.display="none";
    document.getElementById("trDynamic").style.display="";
    document.getElementById("trRecipientDetails").style.display="none";
    document.getElementById("tbBuzzedBy").style.display="none";
    document.getElementById("trSuccessMessage").style.display="none";
    document.getElementById("tblOrderButtons").style.display=""; 
    document.getElementById("tblRecipientPanelButtons").style.display="none"; 
}

//Function to show confirmation message before order is created if user is not logged in
function ShowPayConfirmation()
{  
      ShowBeforeLogin(); 
      ShowModalDialog(ConfirmationModalDialog,null,"Kohai! If you login first you won't need to activate your phone each time you Buzz.  If you're not registered you can do so <a href=\"frmRegistration.aspx\">HERE</a> and get your first BUZZ free!  It's just take a minute!" ,"ConfirmationModalDialogOk","ctl00_focuscontrol");   
}

// *** Captures the modal dialog result 1 - OK 0- Cancel
function ConfirmationModalDialogClick(Result)
{
   if((document.getElementById("ctl00_ContentPlaceHolder1_hdnSendType").value=="RegisteredSendMe")||(document.getElementById("ctl00_ContentPlaceHolder1_hdnSendType").value=="UnregisteredSendMe"))
   { 
        if (Result == 1)
        {
            if(document.getElementById("tbbeforelogin").style.display=="")
            { 
                document.getElementById("ctl00_txtBuzzName").focus();
                activebutton="login";
                showalternatebubble("ctl00_txtBuzzName","login");
                window.setTimeout("document.getElementById('bubble_errortooltip').style.display = 'none'", 4000)
            }
            else
            {
                ShowBeforeLogin();
                document.getElementById("ctl00_txtBuzzName").focus();
                activebutton="login";
                showalternatebubble("ctl00_txtBuzzName","login");
                window.setTimeout("document.getElementById('bubble_errortooltip').style.display = 'none'", 4000)
            }
            document.getElementById("ctl00_ContentPlaceHolder1_hdnSendType").value = "RegisteredSendMe";// ###2873
        } 
        else
        {
           ShowRecipientDetails();
           document.getElementById("ctl00_ContentPlaceHolder1_hdnSendType").value = "UnregisteredSendMe";// ###2873
        }
   } 
   else if((document.getElementById("ctl00_ContentPlaceHolder1_hdnSendType").value=="RegisteredHaveMe")||(document.getElementById("ctl00_ContentPlaceHolder1_hdnSendType").value=="UnregisteredHaveMe"))
   {
         if (Result == 1)
        {
            if(document.getElementById("tbbeforelogin").style.display=="")
            { 
                document.getElementById("ctl00_txtBuzzName").focus();
                activebutton="login";
                showalternatebubble("ctl00_txtBuzzName","login"); 
            }   
            else
            {
                ShowBeforeLogin();
                document.getElementById("ctl00_txtBuzzName").focus();
                activebutton="login";
                showalternatebubble("ctl00_txtBuzzName","login");
            }
        } 
        else
        {
             ShowUnregisteredHaveMeOptions();
             ConfirmationModalDialog.hideDialog();
        }
   }
}

//Function to Hide Personalisation Options
function HidePersonalisationOptions()
{
    document.getElementById("RecipientDetails").style.display="none";
    document.getElementById("PersOptions").style.display="";
    document.getElementById("trSuccessMessage").style.display="none";
    DialogBuyOptions.hideDialog();
    //DialogPINActivation.hideDialog();
    hideTooltip(); 
    hideAlternatetooltip(); 
}

//Function to Show Buy Options
function ShowRegisteredPaymentOptions()
{
    //**DialogPINActivation.hideDialog();
    //**DialogBuyOptions.showDialog();
    //**document.getElementById("ctl00_ContentPlaceHolder1_imgbtnSend").focus();
    document.getElementById("trSenderDetails").style.display="";
    document.getElementById("trPaymentOptions").style.display="";
    document.getElementById("trRecipientDetails").style.display="none"; 
    document.getElementById("trDynamic").style.display="none";
    document.getElementById("trLoggedIn").style.display="none";
    document.getElementById("trInitial").style.display="none";
    document.getElementById("trBeenbuzzeddetails").style.display="none";
    document.getElementById("trSuccessMessage").style.display="none"; 
    document.getElementById("trHaveMeDetails").style.display="none"; 
    document.getElementById("trUnregisteredDetails").style.display="none";
    document.getElementById("trTip").style.display="none";
    document.getElementById("tblOrderButtons").style.display="none"; 
    document.getElementById("tblRecipientPanelButtons").style.display="none";  
}

//Function to Show Avatars div (Registration Page)
function ShowRegAvatars()
{
    DialogRegistrationAvatars.showDialog();
    document.getElementById("ctl00_ContentPlaceHolder1_imgbtnChooseAvatar").focus();
}

//Function to Hide Avatars div (Registration Page)
function HideRegAvatars()
{
    DialogRegistrationAvatars.hideDialog();
}

//Function to Show Photos div (Registration Page)
function ShowRegPhotos()
{
    var myVal,myVal1,myVal2;
    DialogRegistrationPhotos.showDialog();
    document.getElementById("ctl00_ContentPlaceHolder1_imgbtnUploadPhoto").focus();
    //code added by lakshmi to fix internal issue 14(start)
    var who = document.getElementsByName("ctl00$ContentPlaceHolder1$fuPhotos")[0];    
    document.getElementsByName("ctl00$ContentPlaceHolder1$fuPhotos")[0].value = "";    
    var who2 = who.cloneNode(true);    
    who2.onchange= who.onchange;    
    who.parentNode.replaceChild(who2,who);
     if(document.getElementsByName("ctl00$ContentPlaceHolder1$fuPhotos")[0].value == "")////*** Code added by Lakshmi Priya
     {
        var myVal = document.getElementById("ctl00_ContentPlaceHolder1_valFileUpload");
        ValidatorEnable(myVal, false); 
        var myVal1 = document.getElementById("ctl00_ContentPlaceHolder1_valInvalidFile");
        ValidatorEnable(myVal1, false); 
        var myVal2 = document.getElementById("ctl00_ContentPlaceHolder1_valInvalidDimensions");
        ValidatorEnable(myVal2, false); 
     }
     //(end)
}

//Function to hide Photos div (Registration Page)
function HideRegPhotos()
{
    DialogRegistrationPhotos.hideDialog();
}

//Function to Show Avatars div (Index Page)
function ShowAvatars()
{
    DialogPhotos.hideDialog();
    DialogAvatars.showDialog();
    document.getElementById("ctl00_ContentPlaceHolder1_imgbtnChooseAvatar").focus();
}

//Function to Hide Avatars div (Index Page)
function HideAvatars()
{
    DialogAvatars.hideDialog();
}

//Function to Show Photos div (Index Page)
//function ShowPhotos()
//{
//    DialogAvatars.hideDialog();
//    DialogPhotos.showDialog();
//    document.getElementById("ctl00_ContentPlaceHolder1_imgbtnUploadPhoto").focus();
//} commented  and added below function by lakshmi
function ShowPhotos()
{
    DialogAvatars.hideDialog();
    DialogPhotos.showDialog();
    document.getElementById("ctl00_ContentPlaceHolder1_imgbtnUploadPhoto").focus();
    //........Code Added by Lakshmi Priya for Defect012
    var who = document.getElementsByName("ctl00$ContentPlaceHolder1$fuPhotos")[0];    
    document.getElementsByName("ctl00$ContentPlaceHolder1$fuPhotos")[0].value = "";    
    var who2 = who.cloneNode(true);    
    who2.onchange= who.onchange;    
    who.parentNode.replaceChild(who2,who);
    var myVal,myVal1,myVal2;
    if(document.getElementsByName("ctl00$ContentPlaceHolder1$fuPhotos")[0].value == "")
    {
        var myVal = document.getElementById("ctl00_ContentPlaceHolder1_valFileUpload");
        ValidatorEnable(myVal, false); 
        var myVal1 = document.getElementById("ctl00_ContentPlaceHolder1_valInvalidFile");
        ValidatorEnable(myVal1, false); 
        var myVal2 = document.getElementById("ctl00_ContentPlaceHolder1_valInvalidDimensions");
        ValidatorEnable(myVal2, false); 
    } 
      //........Code Added by Lakshmi Priya for Defect012
}

//Function to hide Photos div (Index Page)
function HidePhotos()
{   
    DialogPhotos.hideDialog();
}

//Function to hide activation div
function HideActivation()
{
    DialogRegistrationPINActivation.hideDialog();
    ShowModalDialog(ErrorModalDialog,null,"Woohoo! You're IN! You can activate your phone when you start Buzzing. Somebody stop me!","ErrorModalDialogClose",null,"Images/succes_goat.gif");
}

//Function to show Selected Avatar/Image
function ShowSelectedImage()
{
    document.getElementById("ctl00_ContentPlaceHolder1_hdnImageType").value="Photo";
    if(document.getElementById("photos")!=null)
        DialogPhotos.hideDialog();
    else
        DialogRegistrationPhotos.hideDialog();
}

//Function to show Success Message after Registration is Successful
function ShowSuccessMessage()
{
    ShowModalDialog(ErrorModalDialog,null,"Houston, start the Engines! We have a new Goat!","ErrorModalDialogClose",null,"Images/succes_goat.gif");
    document.getElementById("ctl00_focuscontrol").value="Redirect";
}

//Function to show activation panel
function ShowActivationPanel()
{
    DialogRegistrationPINActivation.showDialog();
    //document.getElementById("ctl00_ContentPlaceHolder1_txtPIN").focus();         //#2978
    var txtPINfocus = document.getElementById("ctl00_ContentPlaceHolder1_txtPIN");//#2978
    document.getElementById("ctl00_ContentPlaceHolder1_txtPIN").focus();          //#2978
    txtPINfocus.focus();                                                          //#2978
    scroll(0,0);
}

//Function to show Success Message after Registration is Successful
function ShowActivationSuccessMessage()
{
    document.getElementById("ctl00_ContentPlaceHolder1_txtPIN").value="";
    DialogRegistrationPINActivation.hideDialog();
    ShowSuccessMessage();
}

/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var persistmenu="yes" 
var persisttype="sitewide"

if (document.getElementById){ 
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

//Function to Show/Hide left menu child nodes
function SwitchMenu(obj,divID,containerid,sbcontainer,sbdown){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("div");
		if(el.style.display != "block"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu")
				ar[i].style.display = "none";
			}
			el.style.display = "block";
			//if((obj=='sub4')||(obj=='sub3'))
			if((obj=='sub4')||(obj=='sub3')||(obj=='sub5')) //#3984 sub5 added for buzztones -- Added by Madhu on 11 Nov 2009
	        {
	            var pos=findPos(document.getElementById(obj));
	            document.getElementById(containerid).style.left=(pos[0])+"px";
	            document.getElementById(containerid).style.top=pos[1]+"px";
	            document.getElementById(sbcontainer).style.left=(pos[0]+185)+"px";
	            document.getElementById(sbcontainer).style.top=pos[1]+"px";	            
	            if(obj=='sub3')
	                document.getElementById(sbdown).style.top=(pos[1]-557)+"px";
                else if(obj=='sub4')
	                document.getElementById(sbdown).style.top=(pos[1]-580)+"px"; 
	            else                                                                //#3984
	                document.getElementById(sbdown).style.top=(pos[1]-603)+"px"; 	            
                loadscroll(divID,sbcontainer)
	        }
		}else{
			el.style.display = "none";
		}
	}
}

//Function to validate whether radiobutton in datalist is checked or not
function ValidateAvatarSelection(objHiddenField)
{					
    var num=document.aspnetForm.elements.length;
   		
	var flag=false;
	var Obj;
	for(var i=0;i<=num-1;i++)
	{
		obj=document.aspnetForm[i];
		
		if(obj.type=="radio")
		{
		        // if obj is from datagrid item
				if(document.aspnetForm.elements[i].checked==true)
				{
					flag=true;
					if((navigator.appName=="Netscape")||(navigator.appName=="Opera"))
					{
					    var path=document.aspnetForm.elements[i].parentNode.childNodes[1].src;
					}
					else if(navigator.appName=="Microsoft Internet Explorer")
					{
					    var path=document.aspnetForm.elements[i].parentNode.firstChild.src;
					}
					document.getElementById("ctl00_ContentPlaceHolder1_hdnImageType").value="Avatar";
					document.getElementById("ctl00_ContentPlaceHolder1_hdnAvatarPath").value=path;
					document.getElementById("ctl00_ContentPlaceHolder1_imgSelectedAvatar").src=path;
					if(document.getElementById("selectedavatar")!=null)
					    document.getElementById("selectedavatar").style.display="";
                     if(document.getElementById("avatars")!=null)
                        DialogAvatars.hideDialog();
                    else
                        DialogRegistrationAvatars.hideDialog();
				}
		}
	}
	if(flag==false)
	{
	    alert('Please select atleast one Avatar.');
	}
}

//Function to show table before a user logins
function ShowBeforeLogin()
{
    if(document.getElementById("ctl00_hdnLoginStatus").value=="")
    {
        document.getElementById("tbbeforelogin").style.display="";
        document.getElementById("tbafterlogin").style.display="none";
        SwapHeader(0); 
    }
}

//Function to show table after user logins
function ShowAfterLogin()
{
    document.getElementById("ctl00_hdnLoginStatus").value="Clicked";
    document.getElementById("tbbeforelogin").style.display="none";
    document.getElementById("tbafterlogin").style.display="";
    SwapHeader(1); 
}

//Function to show 'View Profile' table
function ViewProfile()
{
    document.getElementById("tbDataList").style.display="none";
    document.getElementById("tbProfile").style.display="";
    document.getElementById("tbNoRecords").style.display="none";
}

//Function to show 'Data List' table and left block in player panel
function ShowDataList()
{
    document.getElementById("tbDataList").style.display="";
    document.getElementById("tbProfile").style.display="none";
    document.getElementById("tbNoRecords").style.display="none";
}

//Function to redirect to Index page when buzz cast history is empty
function NoRecordsFound()
{
    document.getElementById("tbDataList").style.display="none";
    document.getElementById("tbNoRecords").style.display="";
    document.getElementById("tbProfile").style.display="none";
}
//Function to hide Activation options page
function HideActivationOptions()
{
   //DialogPINActivation.hideDialog();
   WwModalDialogTest.hideDialog();
}

//Function to preload images
var arImages=new Array();
function Preload()
{ 
    var temp = Preload.arguments;
     for(x=0; x < temp.length; x++)
     { 
        arImages[x]=new Image();
        arImages[x].src=Preload.arguments[x];
     } 
}

//Function to show Forgot Password div
function ShowForgotPassword()
{   
   DialogForgotBuzzword.showDialog();
   document.getElementById("ctl00_txtEmail").focus(); 
}

//Function to hide Forgot Password div
function HideForgotPassword()
{
   DialogForgotBuzzword.hideDialog();
}

//Function to show Buzzword if the inputs are correct
function ShowForgottenBuzzwordSuccessMessage()
{
    DialogForgotBuzzword.hideDialog();
    document.getElementById("ctl00_txtFPBuzzName").value="";
    document.getElementById("ctl00_txtEmail").value="";
    ShowModalDialog(ErrorModalDialog,null,"Be Cool. The email is on your way.",null,null,"Images/succes_goat.gif");
}

//Function to show PIN no. and Mobile number options for BuzzedBy
function ShowBuzzedBy(MobileNumber)
{
      DialogBeenBuzzedTest.showDialog(); //#uc
}

//Function to hide PIN no. and Mobile number options for BuzzedBy
function HideBuzzedByOptions()
{
    
    parent.document.getElementById("ctl00_ContentPlaceHolder1_hidUCSesstionState").value = 1;
    WwModalDialogTest.hideDialog();
    
}

//Function to show been buzzed by details (card pin and mobile number)
//commented by priyatam ###3502 function modified as below
function ShowBuzzedByDetails()
{
    document.getElementById("trBeenbuzzeddetails").style.display="";
    document.getElementById("tbBuzzedBy").style.display=""; //Greeting Message    
    document.getElementById("trInitial").style.display="none";
    document.getElementById("trLoggedIn").style.display="none";
    document.getElementById("trBuzzmakerDetails").style.display="none";
    document.getElementById("trSenderDetails").style.display="none";
    document.getElementById("trPaymentOptions").style.display="none";
    document.getElementById("trRecipientDetails").style.display="none"; 
    document.getElementById("trDynamic").style.display="none";
    document.getElementById("trLoggedIn").style.display="none";
    document.getElementById("trInitial").style.display="none";
    document.getElementById("trSuccessMessage").style.display="none"; 
    document.getElementById("trHaveMeDetails").style.display="none"; 
    document.getElementById("trUnregisteredDetails").style.display="none";
    document.getElementById("trTip").style.display="none";
    document.getElementById("tblOrderButtons").style.display="none"; 
    document.getElementById("tblRecipientPanelButtons").style.display="none";
    //Changed by madhu Murthy on 23rd Oct 2008.
    if(WwModalDialogTest !=null)
    { 
        try
        {
           WwModalDialogTest.hideDialog();
        }
        catch(e){} 
    }                           ////#uc(end)
}

//Function to hide Update profile Activation options page
function HideUpdateProfileActivationOptions()
{
    DialogUpdateProfileActivation.hideDialog();
    ShowModalDialog(ErrorModalDialog,null,"Kohai! Your mobile has been updated. You can activate it when you start Buzzing!",null,null,"Images/succes_goat.gif"); 
}

//Function to show activation panel
function ShowUpdateProfileActivationPanel(number)
{
    document.getElementById("ctl00_ContentPlaceHolder1_hdnMobileNumber").value=number;
    DialogUpdateProfileActivation.showDialog();
    //document.getElementById("ctl00_ContentPlaceHolder1_txtUPPIN").focus();//2978
    var EditActivationPanelfocus = document.getElementById("ctl00_ContentPlaceHolder1_txtUPPIN"); //#2978
    EditActivationPanelfocus.focus(); //#2978
    document.getElementById("ctl00_ContentPlaceHolder1_txtUPPIN").focus(); //#2978
}

//Function to hide Update profile Activation options page
function ShowUpdateProfileSuccessMessage()
{
    DialogUpdateProfileActivation.hideDialog();
    if(document.getElementById("ctl00_ContentPlaceHolder1_imgbtnEditProfile") !=null)
        document.getElementById("ctl00_ContentPlaceHolder1_imgbtnEditProfile").style.visibility="visible"; 
    if(document.getElementById("ctl00_ContentPlaceHolder1_txtUPPIN")!=null)
        document.getElementById("ctl00_ContentPlaceHolder1_txtUPPIN").value=""; 
    ShowModalDialog(ErrorModalDialog,null,"People of Earth I have something to say.. It's better to burn out than to fade away...",null,null,"Images/succes_goat.gif");
}

//Function to hide send me controls
function HideSendMeControls()
{
    document.getElementById("trGreeting").style.display="none";
    document.getElementById("trName").style.display="none";    
    document.getElementById("trEmail").style.display="none"; 
    document.getElementById("UnregisteredControls").style.display="none";
}

//Function to Show send me controls
function ShowSendMeControls()
{
    document.getElementById("trGreeting").style.display="";
    document.getElementById("trName").style.display="";
    document.getElementById("trEmail").style.display=""; 
    document.getElementById("tdUnregisteredOwnMeOperators").style.display="none"; 
}

//Function to show BuzzMaker profile when user clicks on card
function ShowBMProfile()
{
     if(document.getElementById("trInitial")!=null)
        document.getElementById("trInitial").style.display="none";
     if(document.getElementById("trLoggedIn")!=null)
        document.getElementById("trLoggedIn").style.display="none";
     if(document.getElementById("trBeenbuzzeddetails")!=null)
        document.getElementById("trBeenbuzzeddetails").style.display="none";
    if(document.getElementById("trDynamic")!=null)
        document.getElementById("trDynamic").style.display="none";
    if(document.getElementById("trRecipientDetails")!=null)
        document.getElementById("trRecipientDetails").style.display="none";
    if(document.getElementById("trSenderDetails")!=null)
        document.getElementById("trSenderDetails").style.display="none";
    if(document.getElementById("trSuccessMessage")!=null)
        document.getElementById("trSuccessMessage").style.display="none";
     document.getElementById("trBuzzmakerDetails").style.display="";
     hideTooltip();
     hideAlternatetooltip();
}

//Function to prepare BuzzMaker links
function PrepareBuzzMakerLinks(id,link)
{
    document.getElementById(id).href=link;
    document.getElementById(id).style.display=""; 
}

//Function to hide BuzzMaker link(s) if no data exists
function HideBuzzMakerLinks(id)
{
    document.getElementById(id).style.display="none"; 
}

//Function to show weclome message if user logins using cookies
function ShowLoginBeforePanel()
{
    if(location.search.substring(1,location.search.length)=='do=Success')
    { 
         ShowOrderSuccessMessage();
         document.getElementById("imgSendAgain").style.display="none";
    }
    else
    { 
        if(document.getElementById("trInitial")!=null)
            document.getElementById("trInitial").style.display="";
        if(document.getElementById("trLoggedIn")!=null)
            document.getElementById("trLoggedIn").style.display="none";
        if(document.getElementById("trBuzzmakerDetails")!=null)
            document.getElementById("trBuzzmakerDetails").style.display="none";
        if(document.getElementById("trDynamic")!=null)
            document.getElementById("trDynamic").style.display="none";
        if(document.getElementById("trRecipientDetails")!=null)
            document.getElementById("trRecipientDetails").style.display="none";
        if(document.getElementById("trSenderDetails")!=null)
            document.getElementById("trSenderDetails").style.display="none";
        if(document.getElementById("trBeenbuzzeddetails")!=null)
            document.getElementById("trBeenbuzzeddetails").style.display="none";
        if(document.getElementById("trSuccessMessage")!=null)
            document.getElementById("trSuccessMessage").style.display="none";
    }
}

//Function to show normal message if user is not logged in
function ShowLoginAfterPanel()
{
    if(location.search.substring(1,location.search.length)=='do=Success')
    { 
        ShowOrderSuccessMessage();
        document.getElementById("imgSendAgain").style.display="none";
    }
    else
    {  
        if(document.getElementById("trInitial")!=null)
            document.getElementById("trInitial").style.display="none";
        if(document.getElementById("trLoggedIn")!=null)
            document.getElementById("trLoggedIn").style.display="";
        if(document.getElementById("trBuzzmakerDetails")!=null)
            document.getElementById("trBuzzmakerDetails").style.display="none";
        if(document.getElementById("trDynamic")!=null)
            document.getElementById("trDynamic").style.display="none";
        if(document.getElementById("trRecipientDetails")!=null)
            document.getElementById("trRecipientDetails").style.display="none";
        if(document.getElementById("trSenderDetails")!=null)
            document.getElementById("trSenderDetails").style.display="none";
        if(document.getElementById("trBeenbuzzeddetails")!=null)
            document.getElementById("trBeenbuzzeddetails").style.display="none";
        if(document.getElementById("trSuccessMessage")!=null)
            document.getElementById("trSuccessMessage").style.display="none";
    }
}

function ViewDemo()
{
//window.top.location.search.substring(1)
    if(location.search.substring(1,location.search.length)=='do=viewdemo')
    {                
        playdemo()
    } 
}

function playdemo()
{
    if(document.getElementById("outcast")==null)
    {
        window.location="frmIndex.aspx?do=viewdemo"
    }
   else
   {        
        var stringxml ="<?xml version='1.0' encoding='utf-16'?><bmg:Card CardID='106' VideoFileDirectoryPath='http://www.buzzmygoat.com/DemoFiles/' xmlns:bmg='BMGCard'><CardShortName></CardShortName><CardDescription></CardDescription><Segment No_Video_Options='1' PersonalizationType='PLV' PersonalizationOrder='1' IsPrimary='true'><VideoOptions><Video MediaID='324' VideoLength='1.10' Mixoff='0.00'><VideoFile>demo.flv</VideoFile></Video></VideoOptions></Segment></bmg:Card>";                                      
        buzzcast(stringxml)
        hideTooltip()
		hideAlternatetooltip()
   } 
}     

function HideUnregisterdControls()
{
       ShowRecipientDetails();
       ShowSendMeControls(); 
       document.getElementById("UnregisteredControls").style.display="none"; 
}

//Function to validate login details in login.html page
function ShowErrorMessage()
{
    document.getElementById('txtUsername').focus();
    alert('Invalid Details.');   
}

//Function to focus on first textbox in login.html page
function focus()
{
    document.getElementById('textfield').focus();
}

function loaddefaultimage(url)
{
    if(document.getElementById('outcast')!=null)
    {
         var tool = thisMovie('outcast');
         tool.loadimage(url);
    }
}

function MenuItemPreCallBack()
{
	var loading = document.createElement("div");
	loading.id = "loading";
	loading.style.color = "White";
	loading.style.backgroundColor = "pink";
	loading.style.paddingLeft = "5px";
	loading.style.paddingRight = "5px";
	loading.style.position = "absolute";
	loading.style.right = document.body.scrollLeft;
	loading.style.top = document.body.scrollTop;
	loading.style.zIndex = "9999";
	loading.innerHTML = "Loading...";
	loading.style.font = "13px 'Trebuchet MS'";
	loading.style.filter="alpha(opacity:95)";
    loading.style.KHTMLOpacity="0.95";
    loading.style.MozOpacity="0.95";
	document.body.appendChild(loading);
}
function MenuItemPostCallBack()
{
	var loading = document.getElementById("loading");
	if(loading!=null)
	    document.body.removeChild(loading);
}

//******************** Newly added functions for Modial Dialog Popup************************//

//Function to show ModalDialog
//ModalDialogID - ID of Modal to be shown
//ControlID - The controll ID on which the the focus has to be taken after clicking close button on modaldialog
//Message - The message that is to be shown on modal dialog
//FocusOn - The contollID on which the focus has to be taken when ModalDialog is shown
//HiddenFiledControlID - ControlID of hidden field where the controlid of to be focussed after clicking on close is saved
function ShowModalDialog(ModalDialogID,ControlID,Message,FocusOn,HiddenFieldControlID,ImagePath)
{
    try
    {
       if(ImagePath!=null) 
            document.getElementById("imgErrorDialog").src=ImagePath; 
        ModalDialogID.showDialog(Message,null);
        if(FocusOn!=null)
            document.getElementById(FocusOn).focus();
        if(HiddenFieldControlID!=null)
            document.getElementById(HiddenFieldControlID).value=ControlID;
    }
   catch (e)
   {}
}

//Function to validate Login details
function validateLogin()
{
   if(document.getElementById("ctl00_txtBuzzName").value=="")
   { 
        ShowModalDialog(ErrorModalDialog,"ctl00_txtBuzzName","I need your Buzzname Captain!  All you humans look alike to me...","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false;
    }
    else if(document.getElementById("ctl00_txtBuzzword").value=="")
    { 
        ShowModalDialog(ErrorModalDialog,"ctl00_txtBuzzword","I need your Buzzword dude!  It's OK - I'm not looking.","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false;
    }
   return true; 
}

//Function to take focus on a control when close button is clicked on Modial Dialog
function  FocusOn()
{
    var focus=document.getElementById("ctl00_focuscontrol").value;
    if(focus!="")
   {  
        if(focus=="Redirect")
            window.location="frmIndex.aspx";
        else
        {
            try
            {
                document.getElementById(focus).focus(); 
            } 
            catch (err){}
        }
    }
}

//Function that fires when ErrorModalDialog close button is clicked
function  ErrorModalDialogCloseButtonHandler()
{
    ErrorModalDialog.hideDialog();
    var focus=document.getElementById("ctl00_focuscontrol").value;
    if(focus!="")
   {  
        if(focus=="Redirect")
            window.location="frmIndex.aspx";
        else
        {
            try
            {
                document.getElementById(focus).focus(); 
            } 
            catch (err){}
        }
    }
}

//Function to validate Search
function validateSearch()
{
    if(document.getElementById("ctl00_txtSearch").value=="")
    { 
        ShowModalDialog(ErrorModalDialog,"ctl00_txtSearch","Dude! You're searchin for nothing! Try entering a word and I'll open the bank for you.","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false;
    }
   MenuItemPreCallBack(); 
   return true;  
}

//Function to show error message when login failed
function showLoginFailed()
{
    ShowModalDialog(ErrorModalDialog,"ctl00_txtBuzzName","Whoops! Somethin's gone Pete Tong.. I hate that guy!  Can ya type those details again?","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
    return false;
}

//Function to show Registration Failed Message
function showRegistrationFailed()
{
    ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtFirstName","Hmm.. That didn't work. I'll get the geeks. Could you try again in a few minutes?","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
    return false; 
}

//Function to validate registration controls
function ValidateRegistration()
{
   if(document.getElementById("ctl00_ContentPlaceHolder1_txtFirstName").value=="")
   { 
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtFirstName","Now I know it's early on in our relationship.. But don't be shy now.. ENTER YOUR FIRST NAME OK!!!!!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   if(document.getElementById("ctl00_ContentPlaceHolder1_txtBuzzName").value=="")
   { 
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtBuzzName","I do need a Buzzname dude.. Something for me to remember you by..  Come on.. Hit me!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   if(document.getElementById("ctl00_ContentPlaceHolder1_txtEMail").value=="")
   { 
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtEMail","OK grandad, this is the twenty FIRST century OK!  We need your EMAIL ADDRESS!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   if(document.getElementById("ctl00_ContentPlaceHolder1_txtBuzzword").value=="")
   { 
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtBuzzword","I need your Buzzword baby.. (That's a password to all you uninitiated)","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   if(document.getElementById("ctl00_ContentPlaceHolder1_txtMobileNumber").value=="")
   { 
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtMobileNumber","Look baby..  I won't give your mobile number to stalkers or salesmen.. BUT I DO NEED THE NUMBER..  Hit me again!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   if(document.getElementById("ctl00_ContentPlaceHolder1_ddlNetwork").selectedIndex==0)
   { 
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_ddlNetwork","I need your mobile network dude!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   
   if(document.getElementById("ctl00_ContentPlaceHolder1_ddlNetwork").selectedIndex==13)
   { 
        if(document.getElementById("ctl00_ContentPlaceHolder1_ddlPayOptions").selectedIndex==1)
        {
            ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_ddlPayOptions","We can only bill your mobile if you're using one of the networks listed. More soon..! For now please choose Paypal.","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
            return false;
        }
   }
   
   if(document.getElementById("ctl00_ContentPlaceHolder1_ddlSex").selectedIndex==0)
   { 
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_ddlSex","Look I'm from Jupiter Ok, but I need to know if it's Mars or Venus for you? Sex please!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   if(!document.getElementById("ctl00_ContentPlaceHolder1_chkTerms").checked)
   { 
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_chkTerms","Now I'm the Sherriff in this town! You gotta accept my terms if you want to play!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   return true;
}

//Function to validate if Buzzname is entered when usser tries to check buzzname availability
function validateCheckBuzznameAvailability()
{
  if(document.getElementById("ctl00_ContentPlaceHolder1_txtBuzzName").value=="")
   { 
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtBuzzName","I do need a Buzzname dude.. Something for me to remember you by..  Come on.. Hit me!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   return true;
}

//Function to validate registration page pin entry
function validateRegistrationPINActivation()
{
   if(document.getElementById("ctl00_ContentPlaceHolder1_txtPIN").value=="")
   { 
        ErrorModalDialog.zIndex="20000";
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtPIN","I can't let just anybody through here! I need a pin number baby.. Check your text messages!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   return true;
}

function validationForgotBuzzword()
{
     var  email=document.getElementById("ctl00_txtEmail").value
     var  buzzname=document.getElementById("ctl00_txtFPBuzzName").value
     if (((email == "") || (email == null)) && ((buzzname == "") || (buzzname == null)))
        {
            ErrorModalDialog.zIndex="20000";
            ShowModalDialog(ErrorModalDialog,"ctl00_txtEmail","Look dude I'm not a magician!  I need your Email or your Buzzname.. I know it's in there!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
            return false;
        }
}

//Function to validate pin entry
function validatePINActivation()
{
   if(document.getElementById("ctl00_ContentPlaceHolder1_txtPIN").value=="")
   { 
        ErrorModalDialog.zIndex="20000";
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtPIN","I can't let just anybody through here! I need a pin number baby.. Check your text messages!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   return true;
}
//Function to validate pin entry //#uc(start)
function validatePINActivationUC()
{

   if(document.getElementById("ctl00_ContentPlaceHolder1_ucPinActivation_txtPIN").value=="")
   { 
        ErrorModalDialog.zIndex="20000";
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_ucPinActivation_txtPIN","I can't let just anybody through here! I need a pin number baby.. Check your text messages!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   return true;
}
//#uc(end)
function validateSendThisNow()
{
    if ((document.getElementById("ctl00_ContentPlaceHolder1_txtFriendName").value == "") || (document.getElementById("ctl00_ContentPlaceHolder1_txtFriendName").value == null))
    {
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtFriendName","Tell me the name of who you're Buzzin' so I can personalise your message. I'm not negotiating on this one!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif"); 
        return false;
    }
    else if ((document.getElementById("ctl00_ContentPlaceHolder1_txtSenderName").value == "") || (document.getElementById("ctl00_ContentPlaceHolder1_txtSenderName").value == null))
    {
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtSenderName","Hey stranger, I think it's about time we took our relationship to the next level…enter your name!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false;
    } 
}

function validateBeenBuzzed()
{
     if ((document.getElementById("ctl00_ContentPlaceHolder1_txtBuzzedByPIN").value == "") || (document.getElementById("ctl00_ContentPlaceHolder1_txtBuzzedByPIN").value == null))
        {
            ErrorModalDialog.zIndex="20000";
            ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtBuzzedByPIN","Dude.. I need a PIN number to retrieve your message. Check your texts!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
            return false;
        }       
        else if (((document.getElementById("ctl00_ContentPlaceHolder1_txtBuzzedByMobileNumber").value == "") || (document.getElementById("ctl00_ContentPlaceHolder1_txtBuzzedByMobileNumber").value  == null)) && ((document.getElementById("ctl00_ContentPlaceHolder1_txtBuzzedByEmail").value  == "") || (document.getElementById("ctl00_ContentPlaceHolder1_txtBuzzedByEmail") == null)))
        {
            ErrorModalDialog.zIndex="20000";
            ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtBuzzedByMobileNumber","I need your mobile number or email to come up with the goods! Type it in or I'm gonna get real goaty!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
            return false;
        }
    return true;
}
//#UC(start)
function validateBeenBuzzedUCDLG()
{
        if ((document.getElementById("ctl00_ContentPlaceHolder1_ucControl_txtBuzzedByPINNumber").value == "") || (document.getElementById("ctl00_ContentPlaceHolder1_ucControl_txtBuzzedByPINNumber").value == null))
        {
            ErrorModalDialog.zIndex="20000";
            ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_ucControl_txtBuzzedByPINNumber","Dude.. I need a PIN number to retrieve your message. Check your texts!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
            return false;
        }       
        else if (((document.getElementById("ctl00_ContentPlaceHolder1_ucControl_txtBuzzedByMobileNumber").value == "") || (document.getElementById("ctl00_ContentPlaceHolder1_ucControl_txtBuzzedByMobileNumber").value  == null)) && ((document.getElementById("ctl00_ContentPlaceHolder1_ucControl_txtBuzzedByEmail").value  == "") || (document.getElementById("ctl00_ContentPlaceHolder1_ucControl_txtBuzzedByEmail") == null)))
        {
            ErrorModalDialog.zIndex="20000";
            ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_ucControl_txtBuzzedByMobileNumber","I need your mobile number or email to come up with the goods! Type it in or I'm gonna get real goaty!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
            return false;
        }
    return true;

}
function HideUCChangeBuzzword()
{
    parent.document.getElementById("ctl00_ContentPlaceHolder1_hidUCSesstionState").value = 2;
    WwModalDialogTest.hideDialog();
}
function SaveSuccessfully()
{
    parent.document.getElementById("ctl00_ContentPlaceHolder1_hidUCSesstionState").value = 0;
    WwModalDialogTest.hideDialog();
}
//#UC(end)
function ValidateUnregisteredControls()
{
     if ((document.getElementById("ctl00_ContentPlaceHolder1_txtUnregisterdName").value == "") || (document.getElementById("ctl00_ContentPlaceHolder1_txtUnregisterdName").value == null))
        {
            ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtUnregisterdName","Hey stranger, I think it's about time we took our relationship to the next level…enter your name!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
            return false;
        } 
    return true;
}
//#uc(start)
function validateUpdateProfileUC()
{
    if (document.getElementById("ctl00_ContentPlaceHolder1_UserProfile_txtFirstName").value == "")
    {
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_UserProfile_txtFirstName","Now I know it's early on in our relationship.. But don't be shy now.. ENTER YOUR FIRST NAME OK!!!!!","ErrorModalDialog","ctl00_focuscontrol","Images/error_goat.gif");
        return false;
    }
    else if (document.getElementById("ctl00_ContentPlaceHolder1_UserProfile_txtEmail").value == "")
    {
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_UserProfile_txtEmail","OK grandad, this is the twenty FIRST century OK!  We need your EMAIL ADDRESS!","ErrorModalDialog","ctl00_UserProfile_focuscontrol","Images/error_goat.gif");
        return false;
    }
    else if (document.getElementById("ctl00_ContentPlaceHolder1_UserProfile_txtMobileNumber").value == "")
    {
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_UserProfile_txtMobileNumber","Look baby..  I won't give your mobile number to stalkers or salesmen.. BUT I DO NEED THE NUMBER..  Hit me again!","ErrorModalDialog","ctl00_UserProfile_focuscontrol","Images/error_goat.gif");
        return false;
    }
    else if(document.getElementById("ctl00_ContentPlaceHolder1_UserProfile_ddlNetwork").selectedIndex==0)
    { 
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_UserProfile_ddlNetwork","I need your mobile network dude!","ErrorModalDialogClose","ctl00_UserProfile_focuscontrol","Images/error_goat.gif");
        return false; 
    }
   else if(document.getElementById("ctl00_ContentPlaceHolder1_UserProfile_ddlNetwork").selectedIndex==13)
   { 
        if(document.getElementById("ctl00_ContentPlaceHolder1_UserProfile_ddlPayOptions").selectedIndex==1)
        {
            ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder_UserProfile1_ddlPayOptions","We can only bill your mobile if you're using one of the networks listed. More soon..! For now please choose Paypal.","ErrorModalDialogClose","ctl00_UserProfile_focuscontrol","Images/error_goat.gif");
            return false;
        }
   } 
    else
        return true;
    
}
function validateUPPINActivation()
{
   if(document.getElementById("ctl00_ContentPlaceHolder1_txtUPPIN").value=="")
   { 
        ErrorModalDialog.zIndex="20000";
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_txtUPPIN","I can't let just anybody through here! I need a pin number baby.. Check your text messages!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   return true;
}

//Validates auto suggest box in personalization panel for null values
function validateASB()
{
    removeSuggestions();
   //document.getElementById("ctl00_ContentPlaceHolder1_pnDynamic").childNodes[2].childNodes[0].firstChild;
   var count=document.getElementById("ctl00_ContentPlaceHolder1_pnDynamic").childNodes.length;
   for(var i=0;i<=count-1;i++)
   {
        var obj=document.getElementById("ctl00_ContentPlaceHolder1_pnDynamic").childNodes[i];
        if(obj.tagName=='SPAN'&&obj.className!='textsmall')
        {
            if(obj.childNodes.length>0)
           {   
                if(obj.childNodes[0].className!='txtfieldsmall')
                {
                    var obj2=obj.childNodes[1];
                    if(obj2.value=='')
                    { 
                        activebutton="orderbuttons"; 
                        showerrorbubble(obj2.id,'empty')
                        //document.getElementById(obj2.id).focus();
                        return false;
                    }
                }
            }     
        }
   }
   return true;
}

 function loadscroll(id,sbid)
{
    var scroller  = null;
    var scrollbar = null;
    scroller  = new jsScroller(document.getElementById(id), 173, 40);
    scrollbar = new jsScrollbar (document.getElementById(sbid), scroller, true, scrollbarEvent);
}

function scrollbarEvent (o, type) {
    if (type == "mousedown") {
        if (o.className == "Scrollbar-Track") o.style.backgroundColor = "#3d1429";
        else o.style.backgroundColor = "#fba929";
    } else {
        if (o.className == "Scrollbar-Track") o.style.backgroundColor = "#3d1429";
        else o.style.backgroundColor = "#F2428A";
    }
}

function unregisteredBack()
{
    document.getElementById("UnregisteredControls").style.display="none";
    document.getElementById("PersOptions").style.display="";
    document.getElementById("tbBuzzedBy").style.display="none";
    document.getElementById("trSuccessMessage").style.display="none"; 
}

//Function to focus on first auto suggest box in player panel
function FocusAutoSuggest()
{
   var count=document.getElementById("ctl00_ContentPlaceHolder1_pnDynamic").childNodes.length;
   for(var i=0;i<=count-1;i++)
   {
        var obj=document.getElementById("ctl00_ContentPlaceHolder1_pnDynamic").childNodes[i];
        if(obj.tagName=='SPAN'&&obj.className!='textsmall')
        {
            if(obj.childNodes.length>0)
           {   
                if(obj.childNodes[0].className!='txtfieldsmall')
                {
                    var obj2=obj.childNodes[1];
                    obj2.focus();
                    break; 
                }
            }     
        }
   }
   return true;
}

//Function to show/hide recipient mobile field
function SetRecipientMobileFiledsVisibility(type)
{
    if(type=='hide')
    {  
        document.getElementById("tdOnlyEmail").style.display="";
        document.getElementById("trOnlyEmail2").style.display="";
    }
    if(type=='show')
    {  
        document.getElementById("tdOnlyEmail").style.display="none";
        document.getElementById("trOnlyEmail2").style.display="none";
    } 
}

//Function to close ChangeBuzzword Dialog
function HideChangeBuzzword()
{
    DialogChangeBuzzword.hideDialog();
}
//Function to validate //#UC(start)
function validateBuzzwordChangeUC()
{
   ErrorModalDialog.zIndex="20000";
   if(document.getElementById("ctl00_ContentPlaceHolder1_ChangeBuzzword_txtOldBuzzword").value=="")
   { 
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_ChangeBuzzword_txtOldBuzzword","Dude, we need your old Buzzword if you want to change it!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   else if(document.getElementById("ctl00_ContentPlaceHolder1_ChangeBuzzword_txtNewBuzzword").value=="")
   { 
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_ChangeBuzzword_txtNewBuzzword","Type the Buzzword you'd like.","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   else if(document.getElementById("ctl00_ContentPlaceHolder1_ChangeBuzzword_txtConfirmNewBuzzword").value=="")
   { 
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_ChangeBuzzword_txtConfirmNewBuzzword","Kohai! You need to confirm your new Buzzword..","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
   else if(document.getElementById("ctl00_ContentPlaceHolder1_ChangeBuzzword_txtNewBuzzword").value!=document.getElementById("ctl00_ContentPlaceHolder1_ChangeBuzzword_txtConfirmNewBuzzword").value)
   { 
        ShowModalDialog(ErrorModalDialog,"ctl00_ContentPlaceHolder1_ChangeBuzzword_txtNewBuzzword","Hey slipper fingers...that doesn't match! Try try again please!","ErrorModalDialogClose","ctl00_focuscontrol","Images/error_goat.gif");
        return false; 
   }
}
//#UC(end)
//Function to show change buzzword dialog
function ShowChangeBuzzword()
{
     DialogChangeBuzzword.showDialog();
     document.getElementById("ctl00_ContentPlaceHolder1_txtOldBuzzword").focus(); 
}

//Function to show change Bookmark dialog
function ShowBookmark()
{
     DialogBookmark.showDialog();
     document.getElementById("ctl00_ContentPlaceHolder1_imgbtnLoadBookmark").focus(); 
}

//Function to close Bookmark Dialog
function HideBookmark()
{
     WwModalDialogTest.hideDialog();
    //DialogBookmark.hideDialog(); //#uc
}

//Function to return bookmarklink
function createbookmarklink()
{
    return document.getElementById("ctl00_ContentPlaceHolder1_hdnBookmarkLink").value;
}

//Function to return bookmark title
function createbookmarktitle()
{
    return document.getElementById("ctl00_ContentPlaceHolder1_hdnBookmarkTitle").value; 
}

//Swaps the flash header for a logged in user or not logged in user
function SwapHeader(code, vaultpath)
{
//    try
//    { 
//        if(code == 0) //Not logged in
//             document.embeds["FlashHeader"].LoadMovie(0, 'FlashComponent/flashheader.swf'); 
//       else if(code == 1) //Logged in
//             document.embeds["FlashHeader"].LoadMovie(0, 'FlashComponent/header_loggedin.swf');
//      if(code == 0) //Not logged in
//             document.all["FlashHeader"].movie='FlashComponent/flashheader.swf';
//       else if(code == 1) //Logged in
//             document.all["FlashHeader"].movie='FlashComponent/header_loggedin.swf';
//    }
//    catch(err){} 
        
        if(code == 0) //Not logged in
            path = VaultURI() + "/Headers/Hollyoaks Header FlashHeader.swf";
        else if(code == 1) //Logged in
            path = VaultURI() + "/Headers/Hollyoaks Header LoggedInFlashHeader.swf";
        window["header"] = new Object();
        var fo = new FlashObject(path,"header", "1008", "112", "8", "#000000");
        fo.addParam("quality", "high");
        fo.addParam("menu", "false");
        fo.addParam("wmode","transparent"); 
        fo.write("flashheader");
}
//Error message to display when we try to open an invalid buzzcast  ###3455
function ShowErrormsg()
{
 	ShowModalDialog(ErrorModalDialog1,null,"Whooooa! I'm afraid I can't find the Buzz you're looking for. Have a rummage on the left menu, or try the search box. Let's get Buzzing!","ErrorModalDialogClose",null,"Images/succes_goat.gif");
  	document.getElementById("ctl00_focuscontrol").value="Redirect";
}
//###3530 script functions
var maxL = 160;
var enterkeycount=0;
//var strMultiLineText ="";
function taLimit(taObj,e)
{
  //debugger;
  //if(((taObj.value.length))>=maxL)
  //alert(event.ctrlKey) //ctrl-v &&((event.ctrlKey!=true)||(window.event.keyCode!=86))
  var strMultiLineText="";
  strMultiLineText = taObj.value;
  var strSingleLineText="";
  strSingleLineText = strMultiLineText.replace(new RegExp("\\n", "g" ),"");
  
  if(navigator.appName == "Microsoft Internet Explorer")
    {
     if(((strSingleLineText.length))>=maxL) 
  	   {
	    if((e.keyCode != 8)&&(e.keyCode != 9)&&(e.keyCode != 46)&&(e.keyCode!=16)&&(e.keyCode!=38)&&(e.keyCode!=37)&&(e.keyCode!=39)&&(e.keyCode!=40)&&(e.keyCode!=36)&&(e.keyCode!=35)&&(e.keyCode!=17)&&((event.ctrlKey!=true)||(window.event.keyCode!=65))&&((event.ctrlKey!=true)||(window.event.keyCode!=67))&&((event.ctrlKey!=true)||(window.event.keyCode!=88)))
	      { 	 
           if(navigator.appName == "Microsoft Internet Explorer")
             {
	         event.returnValue = false;
	         }
	       else
	         {
	         return false;	  	   
	         }
	      }
	   }
     else
      {
       return true;
	  }	      
    }
  else
    {
     if(((strMultiLineText.length))>=maxL) 
  	   {	
	    if((e.keyCode != 8)&&(e.keyCode != 9)&&(e.keyCode != 46)&&(e.keyCode!=16)&&(e.keyCode!=38)&&(e.keyCode!=37)&&(e.keyCode!=39)&&(e.keyCode!=40)&&(e.keyCode!=36)&&(e.keyCode!=35)&&(e.keyCode!=17)&&((e.ctrlKey!=true)||(e.keyCode!=65))&&((e.ctrlKey!=true)||(e.keyCode!=67))&&((e.ctrlKey!=true)||(e.keyCode!=88)))
	      { 	 
           if(navigator.appName == "Microsoft Internet Explorer")
             {
	         event.returnValue = false;
	         }
	       else
	         {
	         return false;	  	   
	         }
	      }
	   }
     else
      {
       return true;
	  }	      
    }
  
//  if(((strMultiLineText.length))>=maxL) 
//	{
//	//if((e.keyCode != 8)&&(e.keyCode != 9)&&(e.keyCode != 46)&&(e.keyCode!=16)&&(e.keyCode!=38)&&(e.keyCode!=37)&&(e.keyCode!=39)&&(e.keyCode!=40)&&(e.keyCode!=36)&&(e.keyCode!=35)&&(e.keyCode!=17)&&((event.ctrlKey!=true)||(window.event.keyCode!=65))&&((event.ctrlKey!=true)||(window.event.keyCode!=67))&&((event.ctrlKey!=true)||(window.event.keyCode!=88)))
//	 if((e.keyCode != 8)&&(e.keyCode != 9)&&(e.keyCode != 46)&&(e.keyCode!=16)&&(e.keyCode!=38)&&(e.keyCode!=37)&&(e.keyCode!=39)&&(e.keyCode!=40)&&(e.keyCode!=36)&&(e.keyCode!=35)&&(e.keyCode!=17)&&((e.ctrlKey!=true)||(e.keyCode!=65))&&((e.ctrlKey!=true)||(e.keyCode!=67))&&((e.ctrlKey!=true)||(e.keyCode!=88)))
//	   { 	 
//        if(navigator.appName == "Microsoft Internet Explorer")
//	      event.returnValue = false;
//	    else
//	      return false;	  	   
//	   }
//	 }
//  else
//     {
//      return true;
//	 }
}
function taCount(taObj,Cnt) {    
    // debugger;
     var loopcount=0;
     var strSingleLineText="";
  	 objCnt=createObject(Cnt);
	 objVal=taObj.value;
	 var strMultiLineText = taObj.value;	
	 if (objVal.length>maxL) 
       {
	    objVal=objVal.substring(0,maxL);		   
	   }
	 
	  for(var count=0;count<strMultiLineText.length;count++)
      { 
        //orgtext = orgtext + strmessage.charAt(count);             
        if(strMultiLineText.charAt(count) == "\r")        
          loopcount=loopcount+1;        
      }      
	   strSingleLineText = strMultiLineText.replace(new RegExp("\\n", "g" ),"");
	  //if (objCnt) objCnt.innerHTML=((objVal.length))+"/160";
	   if(navigator.appName == "Microsoft Internet Explorer")
	     {
	      //if (objCnt) objCnt.innerHTML=((strSingleLineText.length))+"/160";	      	   
	      if (objCnt) objCnt.innerHTML=((taObj.value.length)-loopcount)+"/160";	      	   
	     }
	   else
	      {
	       //if (objCnt) objCnt.innerHTML=((strSingleLineText.length)+loopcount)+"/160";	      	   
	       //if (objCnt) objCnt.innerHTML=((strMultiLineText.length))+"/160";	      	   
	       if (objCnt) objCnt.innerHTML=((taObj.value.length))+"/160";	      	   
	      }
	  //if (objCnt) objCnt.innerHTML=((strSingleLineText.length))+"/160";	      	   
	 
	  return true;  
}
function createObject(objId) {
	if (document.getElementById) return document.getElementById("ctl00_ContentPlaceHolder1_mycounter");
	else if (document.layers) return eval("document." + objId);
	else if (document.all) return eval("document.all." + objId);
	else return eval("document." + objId);
}
function Limit(taObj,MaxLen) 
{
 //debugger;
 var strAllText= taObj.value; 
 var strMultiLineText = taObj.value;
 var strSingleLineText = strMultiLineText.replace(new RegExp("\\n", "g" ),""); 
if(navigator.appName == "Microsoft Internet Explorer")
  {
    taCount(taObj,'myCounter');
    if(strSingleLineText.length > MaxLen)
     { 
      ShowModalDialog(ConfirmationModalDialogTextarea,"ctl00_ContentPlaceHolder1_txtGreetingMessage","dude...you have reached maximum characters limit,we are truncating extra characters !","ConfirmationModalDialogTextareaOk",null,"Images/succes_goat.gif");
      //taCount(taObj,'myCounter',event); //toget the count value when max limit is crossed
      if(navigator.appName == "Microsoft Internet Explorer")
        {
         event.returnValue = false;
        }
      else
        {
         return false;	 
        }
     }
    else
     {
      //taCount(taObj,'myCounter',event);
      return true;
     }  
  }
else
  {
    
    taCount(taObj,'myCounter');
    if(strMultiLineText.length > MaxLen)
     { 
      ShowModalDialog(ConfirmationModalDialogTextarea,"ctl00_ContentPlaceHolder1_txtGreetingMessage","dude...you have reached maximum characters limit,we are truncating extra characters !","ConfirmationModalDialogTextareaOk",null,"Images/succes_goat.gif");
      //taCount(taObj,'myCounter',event); //toget the count value when max limit is crossed
      if(navigator.appName == "Microsoft Internet Explorer")
        {
         event.returnValue = false;
        }
      else
        {
         return false;	 
        }
     }
    else
     {
      //taCount(taObj,'myCounter',event);
      return true;
     } 
  }

} 
function ConfirmationModalDialogTextareaClick(Result)
{
//debugger;
var count;
var orgtext="";
var loopcount=0;
if(Result==1)
  {
   var strmessage = document.getElementById("ctl00_ContentPlaceHolder1_txtGreetingMessage").value;
   document.getElementById("ctl00_ContentPlaceHolder1_txtGreetingMessage").value="";
   
   if(navigator.appName == "Microsoft Internet Explorer")
     {
       for(count=0;count<(160+loopcount);count++)
          { 
           orgtext = orgtext + strmessage.charAt(count);             
           if(strmessage.charAt(count) == "\r")        
             loopcount=loopcount+1;        
           }	         
	 }
   else
     {
       for(count=0;count<160;count++)
          { 
           orgtext = orgtext + strmessage.charAt(count);             
           //if(strmessage.charAt(count) == "\r")        
           //loopcount=loopcount+1;        
           }
     }      
      document.getElementById("ctl00_ContentPlaceHolder1_txtGreetingMessage").value = orgtext;   
      document.getElementById("ctl00_ContentPlaceHolder1_mycounter").innerHTML="160/160";
      document.getElementById("ctl00_ContentPlaceHolder1_txtGreetingMessage").focus();      
   }
else if(Result==0)
  {
   //document.getElementById("ctl00_ContentPlaceHolder1_txtGreetingMessage").value="";
   document.getElementById("ctl00_ContentPlaceHolder1_txtGreetingMessage").focus();
   //document.getElementById("ctl00_ContentPlaceHolder1_mycounter").innerHTML="0/160";
  }
}


//###3530 script functions
function ShowCalendarDialog() 
{
    CalWwModalDialog1.showDialog();
}
//#4009
function HideCalendarDialog()
{
    CalWwModalDialog1.hideDialog();
    //return false;
}  


//###3530 script functions  
function ShowUCDialog() //#UC
{
    WwModalDialogTest.showDialog();
}




//#3794 bubble.js
// JScript File

var clientid,clienttype,valuex,valuey;
var activetimer,activebutton;

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function showbubble(id,type)
{        
    clientid=id;
    clienttype=type;
    var links,h;
    window.clearTimeout(activetimer);
        
    if((type!="DDL"))
    { 
        if((document.getElementById(id).value==null)||(document.getElementById(id).value==""))
        {
            links=document.getElementById(id);
            PrepareBubble(links,type);
        }
        else
            hideTooltipTimer();
   }
    else
    {
          links=document.getElementById(id);
          PrepareBubble(links,type);
    }
}

function PrepareBubble(el,type)
{
    var tooltip;
    el .focus();
    if(type=="anchor")
    {
        t=el.getAttribute("name");
        if(t==null || t.length==0) t="Description";
    }
    else if(type=="ASB")
    {
        t=el.getAttribute("desc");
        if(t==null || t.length==0) t="Suggestions";
    }
    else if(type=="DDL")
         t=el.getAttribute("desc"); 
    var obj = document.getElementById('bubble_tooltip');
	var obj2 = document.getElementById('bubble_tooltip_content');
	obj2.innerHTML = t;	
    el.tooltip=tooltip;
    el.onmouseout=hideTooltipTimer;
   
    document.getElementById('bubble_tooltip').style.display='block';
    if(document.getElementById('bubble_errortooltip')!=null)
        document.getElementById('bubble_errortooltip').style.display = 'none';

    var len=el.scrollWidth;
   
    var Pos=findPos(el);
    document.getElementById('bubble_tooltip').style.top=(Pos[1]-22)+"px";
    if(type!="DDL") 
	    document.getElementById('bubble_tooltip').style.left = (Pos[0]+len+5) + "px";
	else
	    document.getElementById('bubble_tooltip').style.left = (Pos[0]+len+25) + "px";
	
	document.getElementById('frame').style.height = (document.getElementById('bubble_tooltip').scrollHeight - 8) + "px";
}

function hideTooltipTimer()
{
    activetimer = window.setTimeout("document.getElementById('bubble_tooltip').style.display = 'none'", 4000);
}

function hideTooltip()
{
    document.getElementById('bubble_tooltip').style.display = 'none';
}

function showalternatebubble(id,type)
{
    var links,h;
    window.clearTimeout(activetimer);
    if((type!="login")&&(type!="DDL"))
    { 
        if((document.getElementById(id).value==null)||(document.getElementById(id).value==""))
        {
           links=document.getElementById(id);
           PrepareAlternateBubble(links,type);
        }
        else
            hideAlternatetooltipTimer();
   }
    else
    {
         links=document.getElementById(id);
         PrepareAlternateBubble(links,type);
    }    
}

function PrepareAlternateBubble(el,type)
{
    var tooltip;
    if(type=="anchor")
    {
        t=el.getAttribute("name");
        if(t==null || t.length==0) t="Description";
    }
    else if(type=="ASB")
    {
        t=el.getAttribute("desc");
        if(t==null || t.length==0) t="Suggestions";
    }
    else if(type=="login")
        t="Login here dude";   
    if(t=="Suggestions")
        t="You can Buzz any mobile in the UK or India. More coming soon.Use email to Buzz Bolivia!"; 
    var obj = document.getElementById('bubble_errortooltip');
	var obj2 = document.getElementById('bubble_errortooltip_content');
	obj2.innerHTML = t;
    el.tooltip=tooltip;
    document.getElementById('bubble_tooltip').style.display = 'none';
    document.getElementById('bubble_errortooltip').style.display='block';
    //el.onmouseout=hideAlternatetooltipTimer;
    
   var pos=findPos(el);
	document.getElementById('bubble_errortooltip').style.top=(pos[1]-5)+"px";
	document.getElementById('bubble_errortooltip').style.left = (pos[0]-215) + "px";
}

function hideAlternatetooltipTimer()
{
    if(document.getElementById('bubble_errortooltip')!=null)
      activetimer = window.setTimeout("document.getElementById('bubble_errortooltip').style.display = 'none'", 4000); 
}

function hideAlternatetooltip()
{
    if(document.getElementById('bubble_errortooltip')!=null)
      document.getElementById('bubble_errortooltip').style.display = 'none';
}

function showerrorbubble(id,type)
{
    window.clearTimeout(activetimer);
    var links,h;
    links=document.getElementById(id);
    PrepareErrorBubble(links,type,id);
}

function PrepareErrorBubble(el,type,id)
{
   var tooltip;
   if(type=="error")
    {
       t=el.getAttribute("error");
       if(t==null || t.length==0) t="Name not found";
    }
    else if(type=="empty")
        t="THE GOAT SAYS* “You have to enter a name dude, if you want to play!”";
    else if(type=="invlaid")
        t="Goaty says, I don't know that name. Type a valid name if you want to play!";
    var obj = document.getElementById('bubble_errortooltip');
	var obj2 = document.getElementById('bubble_errortooltip_content');
	obj2.innerHTML = t;
    el.tooltip=tooltip;
    //el.onmouseout=hideAlternatetooltipTimer;
    var pos=findPos(el); 
	document.getElementById('bubble_errortooltip').style.left = (pos[0]-215) + "px";
	document.getElementById('bubble_errortooltip').style.top=(pos[1]-5)+"px";
    document.getElementById('bubble_errortooltip').style.display='block';
    document.getElementById('bubble_tooltip').style.display = 'none';
}

function HideBubbles()
{
    if(activebutton==null)
    { 
        if(document.getElementById('bubble_tooltip')!=null)
            document.getElementById('bubble_tooltip').style.display = 'none';
        if(document.getElementById('bubble_errortooltip')!=null)
          document.getElementById('bubble_errortooltip').style.display = 'none';
     } 
     else
        activebutton=null;    
}
//#3794 ds-sleight.js
// Universal transparent-PNG enabler for MSIE/Win 5.5+
// http://dsandler.org
// From original code: http://www.youngpup.net/?request=/snippets/sleight.xml
// and background-image code: http://www.allinthehead.com/retro/69
// also:
//  * use sizingMethod=crop to avoid scaling PNGs (who would do such a thing?)
//  * only do this once, to make it compatible with CSS rollovers

if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	window.attachEvent("onload", enableAlphaImages);
}

function enableAlphaImages(){
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
	if (itsAllGood) {
		for (var i=0; i<document.all.length; i++){
			var obj = document.all[i];
			var bg = obj.currentStyle.backgroundImage;
			var img = document.images[i];
			if (bg && bg.match(/\.png/i) != null) {
				var img = bg.substring(5,bg.length-2);
				var offset = obj.style["background-position"];
				obj.style.filter =
				"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img+"', sizingMethod='crop')";
				obj.style.backgroundImage = "url('spacer.gif')";
				obj.style["background-position"] = offset; // reapply
			} else if (img && img.src.match(/\.png$/i) != null) {
				var src = img.src;
				img.style.width = img.width + "px";
				img.style.height = img.height + "px";
				img.style.filter =
				"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='crop')"
				img.src = "images/spacer.gif";
			}

		}
	}
}
//#3794 flashobject.js
/**
 * FlashObject v1.3d: Flash detection and embed - http://blog.deconcept.com/flashobject/
 *
 * FlashObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof com=="undefined"){var com=new Object();}
if(typeof com.deconcept=="undefined"){com.deconcept=new Object();}
if(typeof com.deconcept.util=="undefined"){com.deconcept.util=new Object();}
if(typeof com.deconcept.FlashObjectUtil=="undefined"){com.deconcept.FlashObjectUtil=new Object();}
com.deconcept.FlashObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.createElement||!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=com.deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
this.useExpressInstall=_7;
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new com.deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=com.deconcept.FlashObjectUtil.getPlayerVersion(this.getAttribute("version"),_7);
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}
};
com.deconcept.FlashObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},createParamTag:function(n,v){
var p=document.createElement("param");
p.setAttribute("name",n);
p.setAttribute("value",v);
return p;
},getVariablePairs:function(){
var _19=new Array();
var key;
var _1b=this.getVariables();
for(key in _1b){_19.push(key+"="+_1b[key]);}
return _19;
},getFlashHTML:function(){
var _1c="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");
}
_1c="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_1c+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1d=this.getParams();
for(var key in _1d){_1c+=[key]+"=\""+_1d[key]+"\" ";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_1c+="flashvars=\""+_1f+"\"";}
_1c+="/>";
}else{
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_1c="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_1c+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _20=this.getParams();
for(var key in _20){_1c+="<param name=\""+key+"\" value=\""+_20[key]+"\" />";}
var _22=this.getVariablePairs().join("&");
if(_22.length>0){_1c+="<param name=\"flashvars\" value=\""+_22+"\" />";
}_1c+="</object>";}
return _1c;
},write:function(_23){
if(this.useExpressInstall){
var _24=new com.deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_24)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}
}else{this.setAttribute("doExpressInstall",false);}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _23=="string")?document.getElementById(_23):_23;
n.innerHTML=this.getFlashHTML();
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}}};
com.deconcept.FlashObjectUtil.getPlayerVersion=function(_26,_27){
var _28=new com.deconcept.PlayerVersion(0,0,0);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_28=new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{
try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
for(var i=3;axo!=null;i++){
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
_28=new com.deconcept.PlayerVersion([i,0,0]);}}
catch(e){}
if(_26&&_28.major>_26.major){return _28;}
if(!_26||((_26.minor!=0||_26.rev!=0)&&_28.major==_26.major)||_28.major!=6||_27){
try{
_28=new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
}catch(e){}}}
return _28;
};
com.deconcept.PlayerVersion=function(_2c){
this.major=parseInt(_2c[0])||0;
this.minor=parseInt(_2c[1])||0;
this.rev=parseInt(_2c[2])||0;
};
com.deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){return false;}
return true;
};
com.deconcept.util={getRequestParameter:function(_2e){
var q=document.location.search||document.location.hash;
if(q){var _30=q.indexOf(_2e+"=");
var _31=(q.indexOf("&",_30)>-1)?q.indexOf("&",_30):q.length;
if(q.length>1&&_30>-1){
return q.substring(q.indexOf("=",_30)+1,_31);}}return "";
},removeChildren:function(n){
while(n.hasChildNodes()){
n.removeChild(n.firstChild);}}};
if(Array.prototype.push==null){
Array.prototype.push=function(_33){
this[this.length]=_33;
return this.length;};}
var getQueryParamValue=com.deconcept.util.getRequestParameter;
var FlashObject=com.deconcept.FlashObject;

//#3794 jsScrollbar.js
//Written by Nathan Faubion: http://n-son.com
//Use this or edit how you want, just give me
//some credit!
function jsScrollbar (o, s, a, ev) {
	var self = this;
	
	this.reset = function () {
		//Arguments that were passed
		this._parent = o;
		this._src    = s;
		this.auto    = a ? a : false;
		this.eventHandler = ev ? ev : function () {};
		//Component Objects
		this._up   = this._findComponent("Scrollbar-Up", this._parent);
		this._down = this._findComponent("Scrollbar-Down", this._parent);
		this._yTrack  = this._findComponent("Scrollbar-Track", this._parent);
		this._yHandle = this._findComponent("Scrollbar-Handle", this._yTrack);
		//Height and position properties
		this._trackTop = findOffsetTop(this._yTrack);
		this._trackHeight  = this._yTrack.offsetHeight;
		this._handleHeight = this._yHandle.offsetHeight;
		this._x = 0;
		this._y = 0;
		//Misc. variables
		this._scrollDist  = 5;
		this._scrollTimer = null;
		this._selectFunc  = null;
		this._grabPoint   = null;
		this._tempTarget  = null;
		this._tempDistX   = 0;
		this._tempDistY   = 0;
		this._disabled    = false;
		this._ratio = (this._src.totalHeight - this._src.viewableHeight)/(this._trackHeight - this._handleHeight);
		
		this._yHandle.ondragstart  = function () {return false;};
		this._yHandle.onmousedown = function () {return false;};
		this._addEvent(this._src.content, "mousewheel", this._scrollbarWheel);
		this._removeEvent(this._parent, "mousedown", this._scrollbarClick);
		this._addEvent(this._parent, "mousedown", this._scrollbarClick);
		
		this._src.reset();
		with (this._yHandle.style) {
			top  = "0px";
			left = "0px";
		}
		this._moveContent();
		
		if (this._src.totalHeight < this._src.viewableHeight) {
			this._disabled = true;
			this._yHandle.style.visibility = "hidden";
			if (this.auto) this._parent.style.visibility = "hidden";
		} else {
			this._disabled = false;
			this._yHandle.style.visibility = "visible";
			this._parent.style.visibility  = "visible";
		}
	};
	this._addEvent = function (o, t, f) {
		if (o.addEventListener) o.addEventListener(t, f, false);
		else if (o.attachEvent) o.attachEvent('on'+ t, f);
		else o['on'+ t] = f;
	};
	this._removeEvent = function (o, t, f) {
		if (o.removeEventListener) o.removeEventListener(t, f, false);
		else if (o.detachEvent) o.detachEvent('on'+ t, f);
		else o['on'+ t] = null;
	};
	this._findComponent = function (c, o) {
		var kids = o.childNodes;
		for (var i = 0; i < kids.length; i++) {
			if (kids[i].className && kids[i].className == c) {
				return kids[i];
			}
		}
	};
	//Thank you, Quirksmode
	function findOffsetTop (o) {
		var t = 0;
		if (o.offsetParent) {
			while (o.offsetParent) {
				t += o.offsetTop;
				o  = o.offsetParent;
			}
		}
		return t;
	};
	this._scrollbarClick = function (e) {
		if (self._disabled) return false;
		
		e = e ? e : event;
		if (!e.target) e.target = e.srcElement;
		
		if (e.target.className.indexOf("Scrollbar-Up") > -1) self._scrollUp(e);
		else if (e.target.className.indexOf("Scrollbar-Down") > -1) self._scrollDown(e);
		else if (e.target.className.indexOf("Scrollbar-Track") > -1) self._scrollTrack(e);
		else if (e.target.className.indexOf("Scrollbar-Handle") > -1) self._scrollHandle(e);
		
		self._tempTarget = e.target;
		self._selectFunc = document.onselectstart;
		document.onselectstart = function () {return false;};
		
		self.eventHandler(e.target, "mousedown");
		self._addEvent(document, "mouseup", self._stopScroll, false);
		
		return false;
	};
	this._scrollbarDrag = function (e) {
		e = e ? e : event;
		var t = parseInt(self._yHandle.style.top);
		var v = e.clientY + document.body.scrollTop - self._trackTop;
		with (self._yHandle.style) {
			if (v >= self._trackHeight - self._handleHeight + self._grabPoint)
				top = self._trackHeight - self._handleHeight +"px";
			else if (v <= self._grabPoint) top = "0px";
			else top = v - self._grabPoint +"px";
			self._y = parseInt(top);
		}
		
		self._moveContent();
	};
	this._scrollbarWheel = function (e) {
		e = e ? e : event;
		var dir = 0;
		if (e.wheelDelta >= 120) dir = -1;
		if (e.wheelDelta <= -120) dir = 1;
		
		self.scrollBy(0, dir * 20);
		e.returnValue = false;
	};
	this._startScroll = function (x, y) {
		this._tempDistX = x;
		this._tempDistY = y;
		this._scrollTimer = window.setInterval(function () {
			self.scrollBy(self._tempDistX, self._tempDistY); 
		}, 40);
	};
	this._stopScroll = function () {
		self._removeEvent(document, "mousemove", self._scrollbarDrag, false);
		self._removeEvent(document, "mouseup", self._stopScroll, false);
		
		if (self._selectFunc) document.onselectstart = self._selectFunc;
		else document.onselectstart = function () { return true; };
		
		if (self._scrollTimer) window.clearInterval(self._scrollTimer);
		self.eventHandler (self._tempTarget, "mouseup");
	};
	this._scrollUp = function (e) {this._startScroll(0, -this._scrollDist);};
	this._scrollDown = function (e) {this._startScroll(0, this._scrollDist);};
	this._scrollTrack = function (e) {
		var curY = e.clientY + document.body.scrollTop;
		this._scroll(0, curY - this._trackTop - this._handleHeight/2);
	};
	this._scrollHandle = function (e) {
		var curY = e.clientY + document.body.scrollTop;
		this._grabPoint = curY - findOffsetTop(this._yHandle);
		this._addEvent(document, "mousemove", this._scrollbarDrag, false);
	};
	this._scroll = function (x, y) {
		if (y > this._trackHeight - this._handleHeight) 
			y = this._trackHeight - this._handleHeight;
		if (y < 0) y = 0;
		
		this._yHandle.style.top = y +"px";
		this._y = y;
		
		this._moveContent();
	};
	this._moveContent = function () {
		this._src.scrollTo(0, Math.round(this._y * this._ratio));
	};
	
	this.scrollBy = function (x, y) {
		this._scroll(0, (-this._src._y + y)/this._ratio);
	};
	this.scrollTo = function (x, y) {
		this._scroll(0, y/this._ratio);
	};
	this.swapContent = function (o, w, h) {
		this._removeEvent(this._src.content, "mousewheel", this._scrollbarWheel, false);
		this._src.swapContent(o, w, h);
		this.reset();
	};
	
	this.reset();
};

//#3794 jsScroller.js
//Written by Nathan Faubion: http://n-son.com
//Use this or edit how you want, just give me
//some credit!

function jsScroller (o, w, h) {
	var self = this;
	var list = o.getElementsByTagName("div");
	for (var i = 0; i < list.length; i++) {
		if (list[i].className.indexOf("Scroller-Container") > -1) {
			o = list[i];
		}
	}
	
	//Private methods
	this._setPos = function (x, y) {
		if (x < this.viewableWidth - this.totalWidth) 
			x = this.viewableWidth - this.totalWidth;
		if (x > 0) x = 0;
		if (y < this.viewableHeight - this.totalHeight) 
			y = this.viewableHeight - this.totalHeight;
		if (y > 0) y = 0;
		this._x = x;
		this._y = y;
		with (o.style) {
			left = this._x +"px";
			top  = this._y +"px"; 
		}
	};
	
	//Public Methods
	this.reset = function () {
		this.content = o;
		this.totalHeight = o.offsetHeight;
		this.totalWidth	 = o.offsetWidth;
		this._x = 0;
		this._y = 0;
		with (o.style) {
			left = "0px";
			top  = "0px";
		}
	};
	this.scrollBy = function (x, y) {
		this._setPos(this._x + x, this._y + y);
	};
	this.scrollTo = function (x, y) {
		this._setPos(-x, -y);
	};
	this.stopScroll = function () {
		if (this.scrollTimer) window.clearInterval(this.scrollTimer);
	};
	this.startScroll = function (x, y) {
		this.stopScroll();
		this.scrollTimer = window.setInterval(
			function(){ self.scrollBy(x, y); }, 40
		);
	};
	this.swapContent = function (c, w, h) {
		o = c;
		var list = o.getElementsByTagName("div");
		for (var i = 0; i < list.length; i++) {
			if (list[i].className.indexOf("Scroller-Container") > -1) {
				o = list[i];
			}
		}
		if (w) this.viewableWidth  = w;
		if (h) this.viewableHeight = h;
		this.reset();
	};
	
	//variables
	this.content = o;
	this.viewableWidth  = w;
	this.viewableHeight = h;
	this.totalWidth	 = o.offsetWidth;
	this.totalHeight = o.offsetHeight;
	this.scrollTimer = null;
	this.reset();
};
//#3794 swfformfix2.js
/**
 * SWFFormFix v2.1.0: SWF ExternalInterface() Form Fix - http://http://www.teratechnologies.net/stevekamerman/
 *
 * SWFFormFix is (c) 2007 Steve Kamerman and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Project sponsored by Tera Technologies - http://www.teratechnologies.net/
 */
////////////////////////////////////////////////////
////////////  Configurable options  ////////////////
////////////////////////////////////////////////////
var EnableFullAuto	= true; // set this to true and all of your flash objects will be fixed automatically
var SWFFormFixDebug = false; // set this to true to be alerted whenever a flash object is found and fixed
var NotLoadedWarning = false; // set this to true to alert the users when they try to access a function from
							 // the ExternalInterface() that isn't loaded yet
var NotLoadedMsg = "Please wait for the page to load..."; // this is the warning they will see
////////////////////////////////////////////////////
//////////  END Configurable options  //////////////
////////////////////////////////////////////////////
/**
 * Usage:
 * ------------------------------------------------------------
 * There are three ways to use SWFFormFix, FULL AUTO, Auto and Manual mode.
 * To use either method you need to include this file in the 
 * HEAD section of your page like this: 

<script src="swfformfix.js" type="text/javascript"></script>
 /*  
 * NOTE: If you want Javascript to call Flash, you need to make
 * a dummy object like follows:
 
window["myFlashObject"] = new Object();

 * Put this line directly above your call to SWFObject().
 * Replace "myFlashObject" with the ID of your object (the 2nd
 * parameter you give to SWFObject() ).  This will prevent your
 * page from dieing with an error like "myFlashObject is undefined".
 * 
 * --> FULL AUTO Mode:
 * This will attempt to find every Flash Movie that you have on
 * the page and apply the fix to each of them as the page loads.
 * It will poll the page for all the objects and determine if it
 * needs to apply the fix to them every 100ms until the page is
 * completely loaded.  All you need to do to use this mode is
 * include the script in the head of your document and set the
 * "EnableFullAuto" directive to true at the top of the script.
 *
 * --> Auto Mode:
 * This will attempt to find every Flash Movie that you have on
 * the page and apply the fix to each of them.  To use auto mode
 * put the following code before the </body> tag. More specifically
 * it needs to be AFTER your last Flash object.

<script type="text/javascript">
// <![CDATA[
	SWFFormFixAuto();
// ]]>
</script>

 * 
 * --> Manual Mode:
 * This lets you fix just a single Flash object if you don't want
 * the auto mode to try to fix every Flash object on the page.
 * This mode is faster than the auto mode and may work better in
 * some situations.  To use manual mode put the following code
 * after the Flash object you want to fix, where "myFlashObject"
 * is the ID of the Flash Object:

Example for normal EMBED style:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="200" height="100" id="myFlashObject" align="middle">
<param name="movie" value="myMovie.swf" />
<param name="quality" value="high" />
<embed src="myMovie.swf" quality="high" width="200" height="100" name="myFlashObject" type="application/x-shockwave-flash" />
</object>

<script type="text/javascript">
// <![CDATA[
SWFFormFix("myMovieObjectName");
// ]]>
</script>

Example for SWFObject style:

<div id="flashcontent" style="width:200px;height:100px;">This is replaced by the Flash movie.</div>
<script type="text/javascript">
// <![CDATA[
// Please note that the ID that you need to use for SWFFormFix() is the second argument in SWFObject().
var so = new SWFObject("myMovie.swf", "myFlashObject","200", "100", "6.0.0", "#ffffff");
so.addParam("quality", "high");
so.write("flashcontent");
SWFFormFix("myFlashObject");
// ]]>
</script>

 * 
 * Changelog:
 * ------------------------------------------------------------
 * v2.1
 *   Fixed IE cache bug that prevents JS -> Flash after refresh.  Now SWFFormFix
 *   rebuilds all the ExternalInterface() methods that were inadvertently destroyed.
 * v2.0
 *   Added FULL AUTO mode - just enable it below and include the script!
 *   Special thanks to Geoff Stearns from deconcept and onDOMload by Aaron Barker
 * 
 * v1.0
 *   Added the SWFFormFixAuto() function, very well optimized and fast.
 * 
 * v0.2
 *   Changed helper element from <input> element to hidden <div> element
 *
 * v0.1
 *   Initial release.
 */

finished = false; // this is set to true when the body's onload is called, to stop the script
timeout = 10; // seconds to wait before giving up
starttime = new Date().getTime();
flashObjectList = Array();
fixedList = Array();
makeFuncArr = Array();
SWFFormFixAuto2 = function(){
//alert("running...");
	if(navigator.appName.toLowerCase() != "microsoft internet explorer")
	{
		return true;
	}
    var flashObjectList = document.getElementsByTagName("object");
    for(var i=0;i<flashObjectList.length;i++){
		var obj = flashObjectList[i];
		// here's all the objects on the page, now lets find the flash objects
		if(obj.getAttribute('classid') == "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"){
			var id = obj.getAttribute('id');
			var alreadyfixed = false;
			for(var c=0;c<fixedList.length;c++){if(fixedList[i] == id)alreadyfixed=true;}
			// this is a flash movie, apply the fix (unless it's already been fixed)
			if(!alreadyfixed){
				var debugtxt = '';
				for(var b in window[id]){
					// ExternalInterface() tried to add some functions to the incorrect object
					if(typeof(window[id][b])=="function"){
						// this function will need to be rebuilt when the page is done loading.
						makeFuncArr.push(Array(obj,b));
						obj[b] = function(){
							if(NotLoadedWarning)alert(NotLoadedMsg);
							return("");
						}
					}
				}
				window[id]=obj;
				if(SWFFormFixDebug)alert("Fixed: "+id);
			}
		}
	}
	if(!finished){
		setTimeout("SWFFormFixAuto2()", 100);
	}else{
		for(var i=0;i<makeFuncArr.length;i++){
			// this is executed after the page is loaded - it rebuilds the custom
			// ExternalInterface() functions
			SWFFormFix_rebuildExtFunc(makeFuncArr[i][0],makeFuncArr[i][1]);
		}
	}
	return true;
}
SWFFormFix_rebuildExtFunc = function(obj,functionName){
	eval('obj[functionName] = function(){return eval(this.CallFunction("<invoke name=\\"'+functionName+'\\" returntype=\\"javascript\\">" + __flash__argumentsToXML(arguments,0) + "</invoke>"));}');
	if(SWFFormFixDebug)alert("Rebuilt ExternalInterface() function: "+functionName);
}
SWFFormFixOnloadAppend = function() {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = function(){
			finished=true;
		}
	} else {
		window.onload = function() {
			oldonload();
			finished=true;
			
		}
	}
}
SWFFormFixAuto = function(){
	if(navigator.appName.toLowerCase() != "microsoft internet explorer")return true;
	var objects = document.getElementsByTagName("object");
	if(objects.length == 0) return true;
	for(i=0;i<objects.length;i++){
		// here's all the objects on the page, now lets find the flash objects
		if(objects[i].classid == "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"){
			// this is a flash movie, apply the fix
			window[objects[i].id] = objects[i];
		}
	}
	var out = "";
	return true;
}
SWFFormFix = function(swfname){
	if(navigator.appName.toLowerCase() != "microsoft internet explorer")return false;
	var testnodename = "SWFFormFixTESTER";
	document.write('<div id="'+testnodename+'" onclick="SWFFormFixCallback(this,\''+swfname+'\');return false;" style="display:none">&nbsp;</div>');
	document.getElementById(testnodename).onclick();
}
SWFFormFixCallback = function (obj,swfname){
	var path = document;
	var error = false;
	var testnode = obj;
	while(obj = obj.parentNode){
		if(obj.nodeName.toLowerCase() == "form"){
			if(obj.name != undefined && obj.name != null && obj.name.length > 0){
				path = path.forms[obj.name];
			}else{
				alert("Error: one of your forms does not have a name!");
				error = true;
			}
		}
	}
	testnode.parentNode.removeChild(testnode);
	if(error) return false;
	window[swfname]=path[swfname];
	return true;
}
/*function noCacheIE(url){
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	if(!isIE)return(url);
/*	var newUrl = '?';
	if(url.indexOf('?') != -1)newUrl = '&';
	var now = new Date();
	var rand = Math.random().toString().substring(2,4);
	newUrl = url+newUrl+"noCacheIE="+rand+'-'+now.getTime().toString();
	return(newUrl);
}*/
if(EnableFullAuto){
	SWFFormFixAuto2();
	SWFFormFixOnloadAppend();
}


