﻿var _vodlink;
var _VodName;
var browserType;
var objXML;
var objXML1;
var ObjXMLDom;
var xmlPage;
var parm;
var _MyNav;
var _MyErrStr;
var channelMenuTimer = 0;
var recordedMenuTimer = 0;
var MyShowMenuTimer = 0;
var _BR = 0;
var MyIm;
var OpenImRequset;
var ie = false;
var ff = false;
var ob = false;
var _LogInLocation = 0;
var _onDivCloseRefresh=false;
var flashObj = "";
var AlertStr = "";
var AlertPid = 0;
var spaceFlag;
var _LAST_ERR_DIV = "";
var _LAST_ERR_BOREDE_COLOR = "";
var fileChangedFlag = false;
var fileLodedFlag = false;
var _AIMPlayer;
var _ShowInnerDiv = true;
var _ForumPage = false;
var _scheduleDiv = false;
var _isPageOwner = false;
var _isSubscribe = false;
var _banner;
function $g(v){
    return document.getElementById(v);    
}
function $n(v){
    return document.getElementsByName(v);
}
function ChangeBackPass(idName){
   obj= $g(idName);
   obj.style.backgroundImage="";
   obj.style.background="";
   obj.style.background="#404040";
}
function ChangeBackPassHP(){     
    obj=$g("UserPsw");
    obj.style.background='';
    obj.style.backgroundImage='url("'+IMG_SERVER_URL+'bg_text_fild.gif")';
}  
function changeTitle(NewTitle)
{     window.document.title = NewTitle;
}
function isOnBlogTV()
{
    return true
}
//////////////////////////////////////////////////////////////////////////////////
//Browser name: BrowserDetect.browser 
//Browser version: BrowserDetect.version 
//OS name: BrowserDetect.OS 

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
var blogTvSupported = true;
   
if(BrowserDetect.browser == "Safari"){
    blogTvSupported =false ;}
    


/////////////////////////////////////////////////////////////////////////////////
function getBrowserType()
{     if (document.implementation && document.implementation.createDocument) 
  {     browserType = 'mozilla';
        ff = true;
} 
    else if (window.ActiveXObject) 
  {     browserType = 'ie';
        ie = true;
  }
  else 
  {     browserType = 'unknown';
        ob = true;
  }
}

function setObjXMLDom()
{     if (window.XMLHttpRequest)
    {     ObjXMLDom = document.implementation.createDocument("", "", null);        
          ObjXMLDom.onload = RsChange;
    }    
    else 
    {     ie = true;
          ObjXMLDom = new ActiveXObject("Microsoft.XMLDOM");   
          ObjXMLDom.onreadystatechange=RsChange;     
    }
}

// Don't Use //
function setObjXML()
{     if (window.XMLHttpRequest)
    {     objXML = new XMLHttpRequest();
    }
    else 
    {     ie = true;
          objXML = new ActiveXObject("Microsoft.XMLHTTP");        
    }
}
// Don't Use //

function CreateObjXML()
{     if (window.XMLHttpRequest)
    {     return (new XMLHttpRequest());
    }
    else 
    {     ie = true;
            return (new ActiveXObject("Microsoft.XMLHTTP"));
    }
}

function setObjXML1()
{     if (window.XMLHttpRequest)
    {     objXML1 = new XMLHttpRequest();
    }
    else 
    {     ie = true;
          objXML1 = new ActiveXObject("Microsoft.XMLHTTP");        
    }
} 
///////////////////// Chars Functions ///////////////////////
var reLetter = /^[a-zA-Z]$/;
var reDigit = /^\d/;
var reEmail = /^.+\@.+\..+$/;

  String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); };

  function isLetter (c)
  {     return reLetter.test(c);
  }

  function isDigit (c)
  {   return reDigit.test(c);
  }
  
  function isEmpty(s)
  {   return ((s == null) || (s.length == 0));
  }
  
  function isEmail (s)
  {     if (isEmpty(s)) 
              if (isEmail.arguments.length == 1) return false;
              else return (isEmail.arguments[1] == true);      
        else 
        {     var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
              return reEmail.test(s) && filter.test(s);
        }
  }
  function EnterPress(e)
  {     var key = window.event ? e.keyCode : e.which;    
        if (key==13)                      
             return true;
        else            
            return false;
  }
  
  function CheckForEnter(e)
  {     var key = window.event ? e.keyCode : e.which;    
        if (key==13)
             Login(0);     
        	
  }
  function CheckForEnterDiv(e,divNum){     
    var key = window.event ? e.keyCode : e.which;    
    if (key==13)
        Login(divNum);    
            	
  }
  function isNumber(e){     
    var key = window.event ? e.keyCode : e.which;
	var keychar = String.fromCharCode(key);
  	strNumbers = new String();
	strNumbers = "1234567890";
	if ((strNumbers.indexOf(keychar) == -1) && (key!=8) && (key!=0))
	    return false;
	else
        return true;
  }
//=== Check if a string is Numeric
function IsNumeric(sText)
{
    var ValidChars = "0123456789.";
    var IsNumber=true;
    var Char; 
    for (i = 0; i < sText.length && IsNumber == true; i++) 
    { 
        Char = sText.charAt(i); 
        if (ValidChars.indexOf(Char) == -1) 
        {
            IsNumber = false;
         }
    }
    return IsNumber;       
}
//===
  function ispostal(e,obj)
  {
    var key = window.event ? e.keyCode : e.which;
    if( isSpace(e) || isEnglish(e) || isNumber(e))
    {
        postalObj = new String(obj.value);            
        if (postalObj.length == 0)
        {   //Not First Letter (D,d,F,f,I,i,O,o,Q,q,U,u,W,w,Z,z)
            if ((key==100) || (key == 68) || (key==102) || (key == 70) || (key==105) || (key == 73) || (key==111) || (key == 79) || (key==113) || (key == 81) || (key== 117) || (key == 85) || (key== 119) || (key == 87) || (key== 122) || (key == 90) )
            {
                return false;
            }
            else
            {
                return true;
            }
        }
     }
  }
  function PostalFirstLetter(letter)
  {
    letter = new String(letter);
    letter = letter.toLowerCase() ;       
    if ((letter=="d") || (letter=="f") || (letter=="i") || (letter=="o") || (letter=="q") || (letter=="u") || (letter=="w") || (letter=="z") )
    {
        return true;
    }
    else
    {
        return false;
    }        
  }
  //=== check if key press is valid relatively to CookieFolder
  function isLanguage(e)
  {
    var key = window.event ? e.keyCode : e.which;

    switch (CookieFolder)
    {
        case "en":
            return isEnglish(e);
            break;
        case "ru":            
            return isRussian(e);
            break;
        default:
            alert("Error");
            return false;
    }
  }
  //=== check if key press is English
  function isEnglish(e)
  {
    var key = window.event ? e.keyCode : e.which;
    if ((key!=0) && (key > 64) && (key < 123) && (key!=8) && (key!=91) && (key!=92) && (key!=93) && (key!=94) && (key!=96) && (key!=95))
    {     return true;
    }
    else
    {     return false;
    }
  }

  //=== check if key press is Russian
  function isRussian(e)
  {
    var key = window.event ? e.keyCode : e.which;

    if ((key!=0) && (key > 1039) && (key < 1104) && (key!=8) && (key!=91) && (key!=92) && (key!=93) && (key!=94) && (key!=96) && (key!=95))
    {     
        return true;
    }
    else
    {     
        return false;
    }
  }
  //==
  function Chars_CheckStr4Tags(e)
  {
      var key = window.event ? e.keyCode : e.which;
      //Allow :English chars;numbers;space (Ucase & Lcaes)
      if(((key>=65)&&(key<=90))||((key>=97)&&(key<=122))||((key>=48)&&(key<=57))||(key==32)||(key==8)||(key==45)||(key >= 1040 && key <= 1103))
      {
        return true;
      }
      else
      {
        return false;
      }
  }              
  function Chars_CheckStr4Users(e)
  {
      var key = window.event ? e.keyCode : e.which;
      //Allow :English chars;numbers;space;comma (Ucase & Lcaes)          
      if(((key>=65)&&(key<=90))||((key>=97)&&(key<=122))||((key>=48)&&(key<=57))||(key==32)||(key==8)||(key==45)||(key==44)||(key==95)||(key==0))
      {
        return true;
      }
      else
      {
        return false;
      }
  }     
  function Chars_CheckValidString(Str,FlagText)
  {
       if(FlagText==1)
       {
            AlertText1 = "You are not allowed to put minus after minus in the field: Tags";
            AlertText2 = "Only numbers, letters, spaces and minus&#39; are allowed in the field: Tags";                
       }
       else
       {
            AlertText1 = "You are not allowed to put minus after minus in the field: Personal Tags ";
            AlertText2 = "Only numbers, letters, spaces and minus are allowed in the field: Personal Tags";           
       }
       
       var keychar;
       var CharsFlag = true;
       for(i=0;i<Str.length;i++)
       {
            keychar = Str.charCodeAt(i);  
            if(((keychar>=65)&&(keychar<=90))||((keychar>=97)&&(keychar<=122))||((keychar>=48)&&(keychar<=57))||(keychar==32)||(keychar==8)||(keychar==45)||(keychar >= 1040 && keychar <= 1103))
            {
                if((keychar==45)&&(i>0))
                {
                    if(Str.charCodeAt(i-1)==45)
                    {
                        blogtvAlert(AlertText1);
                        CharsFlag = false;
                        break;
                    }
                }
            }
            else
            {
                blogtvAlert(AlertText2);
                CharsFlag = false;
                break;
            }
        }
        return CharsFlag;
  }       
  
  function isSpace(e)
  {     var key = window.event ? e.keyCode : e.which;
        if (key==32)
        {     return true;
        }
        else
        {     return false;
        }      
  }  
 function isUserNameExtraSigns(e){
    var key = window.event ? e.keyCode : e.which;
    return (key>32&&key<=126); 
 }
  function isEnglishAndSigns(e)
{     var key = window.event ? e.keyCode : e.which;
        // event.keyCode (32) ==> " "
        // event.keyCode (45) ==> "-"
        // event.keyCode (95) ==> "_"
        // event.keyCode (64) ==> "@"
        // event.keyCode (46) ==> "."
        if (key == 59 || key == 32 || key == 95 || key == 46 || key == 64 || key == 45 || ((key > 64) && (key < 123)) && (key != 94) && (key != 91) && (key != 92) && (key != 93))
	{     return true;
	}
	else
	{     return false;
	}
}

  function isEnglishAndSigns4Emails(e)
{     var key = window.event ? e.keyCode : e.which;
        // event.keyCode (45) ==> "-"
        // event.keyCode (95) ==> "_"
        // event.keyCode (64) ==> "@"
        // event.keyCode (44) ==> ","
        // event.keyCode (46) ==> "."
        if (key == 59 || key == 95 || key == 46 || key == 64 || key == 45 || key == 44 || ((key > 64) && (key < 123)) && (key != 94) && (key != 91) && (key != 92) && (key != 93))
	{     return true;
	}
	else
	{     return false;
	}
}
      
function isSigns(e,CaseNumber,InStr)
{     if (CaseNumber=="" || CaseNumber == null)
        {     CaseNumber = 0;
        }            
        var key = window.event ? e.keyCode : e.which;
        // event.keyCode (32) ==> " "
        // event.keyCode (45) ==> "-"
        // event.keyCode (95) ==> "_"
        // event.keyCode (64) ==> "@"
        // event.keyCode (46) ==> "."            
        switch (CaseNumber)
      {     case 0: //General
                if (key == 0 || key == 59 || key == 32 || key == 95 || key == 46 || key == 64 || key == 45 || ((key > 64) && (key < 123)) && (key != 94) && (key != 91) && (key != 92) && (key != 93))
                {     return true;
        		}
        		else
        		{     return false;
        		}
                  break;
            case 1: //SignIn
                var KeyUnderscoreFlag = true;
                var KeyMinusFlag = true;
                if (key == 95)
                {
                    if(InStr.indexOf("_")>-1) KeyUnderscoreFlag=false;
                }      
                if (key == 45)
                {
                    if(InStr.indexOf("-")>-1) KeyMinusFlag = false;
                }              
                                       
                if (key == 0 || (key == 95 && KeyUnderscoreFlag) || (key == 45 && KeyMinusFlag))
                {                             
                    return true;
        		}
        		else
        		{     
        		    return false;
        		}
                  break;
            case 2: //free text 
                if((key == 0) || (key == 32)||(key == 95)||(key == 45))
                {
                    return true;
                }
                else
                {
                    return false;
                }
                break;	            
        }
        
}
  
function replaceOnkeyUp(itm)
{
    //checking for -- in onkeyup event
    var InStr = itm.value;
    if(InStr.indexOf("--")>-1)
    {
        itm.value = InStr.replace("--","-");
    } 
}
  
  function removeAllSpaces(string) 
  {     if(string=="" || typeof string=="undefined")
            return "";
        return string.replace(" ","");
  }
  
  function removeSpaces(string){     
        var temp = "";
        splitstring = string.split(" ");
        for(var i = 0; i < splitstring.length; i++){
            if(splitstring[i]!="")
                temp += splitstring[i] + " ";
              
	    }	
	    return temp;
  }

  function SetSpaces(string,MaxLen)
  {       return string;
          var temp = "";
	      string = '' + string;
	      splitstring = string.split(" ");
	      var i;
	      for(i = 0; i < splitstring.length; i++)
	      {     myString = new String(splitstring[i]);
              if(myString.length > MaxLen)
              {     while(myString.length >= MaxLen)
                    {     Fstr = myString.substr(0,MaxLen);
                          Lstr = myString.substr(MaxLen,myString.length);
                          temp += Fstr + " ";
                          myString = new String(Lstr);                  
                    }
                    temp += Lstr+ " ";
              }
              else
              {     if(splitstring[i]!="")
                    {     temp += splitstring[i] + " ";
                    }  
              }                  
	          while(temp.indexOf("--")!=-1)
	          {     temp = temp.replace("--","- -");
	          }
	      }    	
	      return temp;
  }

  function SetSpaces4Tags(Tags,MaxLen)
  { return Tags;    
    var temp = "";
	var TagsTemp = "";
	var i;
	var j;
	Tags = '' + Tags;
	if(Tags!="")
	{     splitTags = Tags.split(" ");    			
	      for(j = 0; j < splitTags.length; j++)
	      {     temp = '';
	    	      string = '' + splitTags[j];
	    	      splitstring = string.split(" ");    	
	    	      for(i = 0; i < splitstring.length; i++)
	    	      {     myString = new String(splitstring[i]);
	                  if(myString.length > MaxLen)
	                  {     while(myString.length >= MaxLen)
	                        {     Fstr = myString.substr(0,MaxLen);
	                              Lstr = myString.substr(MaxLen,myString.length);
	                              temp += Fstr + " ";
	                              myString = new String(Lstr);                    
	                        }
	                        temp += Lstr+ " ";
	                  }
	                  else
	                  {     if(splitstring[i]!="")
	                        {     temp += splitstring[i] + " ";
	                        }  
	                  }
	    	      }    	
    		      TagsTemp = TagsTemp + " " + temp;
		      while(TagsTemp.indexOf("--")!=-1)
		      {     TagsTemp = TagsTemp.replace("--","- -");
		      }			
		}
		TagsTemp = TagsTemp + " ";
		return TagsTemp;
	}
  }
    
  function CutStr(Str,Len)
  {     if(Str.length >=Len)
        {     document.write (Str.substring(0,Len)+ " ...");    
        }
        else
        {     document.write (Str);
        }
  }

  function checkStrLen(string,e,MaxBR,MaxLen)
  {     myString = new String(string);
        var key = window.event ? e.keyCode : e.which;
        splitstring = string.split(String.fromCharCode(13));
        if(myString.length <= MaxLen || key==8 || key==37 || key==38 || key==39 || key==40 || key==46)
        {     if(key==13)
              {     return false;
              }
              return true;
        }
        else
        {     return false;
        }
  }
       
function checkStrLenAnableEnter(string,e,MaxLen)
  {               
    myString = new String(string);
    var key = window.event ? e.keyCode : e.which;
    if(myString.length < MaxLen || key==8 || key==37 || key==38 || key==39 || key==40 || key==46)
    {     
        return true;
    }
    else
    {     return false;
    }      
  }           
       
function replaceSpaces(str)
{
    var CleanStr;
    myString = new String(str);
    while(myString.indexOf("&nbsp;")!=-1)
    {
    	myString = myString.replace("&nbsp;"," ");
    }
    return myString;
}
///////////////////// Chars Functions ///////////////////////

///////////////////// Date Functions ///////////////////////
var daysInMonth = new Array(12);
daysInMonth[1] = 31;
daysInMonth[2] = 29;
daysInMonth[3] = 31;
daysInMonth[4] = 30;
daysInMonth[5] = 31;
daysInMonth[6] = 30;
daysInMonth[7] = 31;
daysInMonth[8] = 31;
daysInMonth[9] = 30;
daysInMonth[10] = 31;
daysInMonth[11] = 30;
daysInMonth[12] = 31;

function daysInFebruary (year)
{   
    return (  ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) ? 29 : 28 );
}

function isDate (year, month, day)
{   
    var intYear = parseInt(year);
    var intMonth = parseInt(month);
    var intDay = parseInt(day);
    
    if (intDay > daysInMonth[intMonth]) return false; 
    if ((intMonth == 2) && (intDay > daysInFebruary(intYear))) return false; 
    
    return true;
}

  function CheckPostal(Postal)
  {     var ValidPostal = true;
        Postal = new String(removeAllSpaces(Postal));
        if (Postal.length != 6)
        {     ValidPostal = false;
        }
        for(l=0;l<=Postal.length-1;l++)
        {     Letter = Postal.substr(l,1);
              if(l%2==0)
              {     if (!isLetter(Letter))
                    {     ValidPostal = false;
                    }
                    if (l==0 && ValidPostal)//First Letter Check 
                    {                                               
                        if (PostalFirstLetter(Letter))
                        {   ValidPostal = false;
                        }
                    }
              }      
              else
              {     if (!isDigit(Letter))
                    {
                          ValidPostal = false;
                    }
              }  
              if (!ValidPostal)
              {     break;
              } 
        }  
        return ValidPostal;          
  }
      
function isLegalMail(Email)
{   if (!isEmail (Email))
	{     blogtvAlert("Invalid E-mail ");
		return false;
	}
    else
    {     return true;
    }
}

function ShowMyTags()
{     MyTagTdObj = $g("MyTagTd");    
        if(MyTagTdObj.style.display == "none")
        {     MyTagTdObj.style.display = "block";
        }
        else
        {     MyTagTdObj.style.display = "none";
        }
}

function AddUserTag(Tag)
{     ProgramTagObj = $g("ProgramTags").value;
        Tag = Tag + ",";
        ProgramTagObj = Tag + ProgramTagObj; 
        $g("ProgramTags").value = ProgramTagObj;
}

function CheckMinAge(year,Month,Day,MinAge)
{   now = new Date();
    born = new Date(year, Month*1-1, Day);        
    years = Math.floor((now.getTime() - born.getTime()) / (365.25 * 24 * 60 * 60 * 1000));        
    
    if (years < MinAge) 
    {   return false;
    }
    else
    {   return true;
    }        	
}
///////////////////////////////////////////////////////////

//////////////////////  Err Div  //////////////////////////
function SetDivErr(str, DivName, BC, ClassN)
{   
    if(ClassN=="")
    {   ClassN = "ErrMsg";
    }
    if(BC=="")
    {   BC = "red";
    }
    _LAST_ERR_DIV = DivName;        
    DivErrContentObj = $g(DivName+"_Err"); 
    DivErrObj = $g(DivName);    
    if(DivErrObj)
    {         
        _LAST_ERR_BOREDE_COLOR = DivErrObj.style.borderColor;                
        if(DivErrContentObj)
        {   DivErrContentObj.innerHTML = "<font class='"+ClassN+"'>" + str + "</font>";
        }
        if(DivErrObj)        {   
            if(DivErrObj.tagName=="INPUT")
            {   DivErrObj.style.borderColor = BC;
            }
            else
            {   DivErrObj.style.border = "solid 1px " + BC;
            }          
        }
    }
}
function RemoveDivErr(BC)    
{           
    if (_LAST_ERR_DIV!="")
    {
        if(_LAST_ERR_BOREDE_COLOR!="")
        {   BC = _LAST_ERR_BOREDE_COLOR;
            _LAST_ERR_BOREDE_COLOR = "";
        }
        if(BC=="")
        {   BC = "#848484";
        }           
        DivErrContentObj = $g(_LAST_ERR_DIV+"_Err"); 
        DivErrObj = $g(_LAST_ERR_DIV); 
        if(DivErrContentObj)
        {   DivErrContentObj.innerHTML = "";
        }            
        if(DivErrObj)
        {   if(DivErrObj.tagName=="INPUT" || BC!= "")
            {   DivErrObj.style.borderColor = BC;
            }
            else
            {   DivErrObj.style.border = "";
            }
        }
    }
}
//////////////////////  Err Div  //////////////////////////
//Counter To Blog TV Programs
var SetCount;
var countdownTimeout = 0;
function countdown(year, month, day, hour, minute, ProgId, ServerTime)
{  
     if(ServerTime=='')
     {
         Str="TD="+day+"&TM="+month+"&TY="+year+"&TH="+hour+"&TMi="+minute;
         TimeobjXML = CreateObjXML();
         TimeobjXML.open("POST", "/Ajax/Schedule_GetTImeFromServer.asp" ,false); 
         TimeobjXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
         //TimeobjXML.onreadystatechange=batchRsChange;
         TimeobjXML.send(Str);
         if (TimeobjXML.responseXML)
         { 	       
             var Today = TimeobjXML.responseXML.getElementsByTagName("Tdate");
             Today = new Date(Today[0].firstChild.data);          	     
             var Tzone = TimeobjXML.responseXML.getElementsByTagName("Tzone");
             Tzone =  Tzone[0].firstChild.data;
             var TargetTime = TimeobjXML.responseXML.getElementsByTagName("TargetTime");
             TargetTime = new Date(TargetTime[0].firstChild.data);                 
             Todays_Year = Today.getFullYear() - 2000;
             Todays_Month = Today.getMonth() + 1;                  
             
             //Convert both today's date and the target date into miliseconds.                           
             Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
                                     Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();                                 		        
	         if(ProgId!='0')
	         {
		        DivSchedTime="SchedTime"+ProgId;
	         }  		
	         else
	         {
		        DivSchedTime="SchedTime";
	         }	             
             if($g(DivSchedTime))
             {
                $g(DivSchedTime).innerHTML="<font class='TitlesLightBlue'>"+Tzone+"</font><br>";
             }
             else
             {
                return false;
             }
             year=parseInt(TargetTime.getFullYear()-2000); 
             month=parseInt(TargetTime.getMonth()+1); 
             day=TargetTime.getDate(); 
             hour=TargetTime.getHours(); 
             minute=TargetTime.getMinutes();
             Target_Date = (new Date(year,month,day,hour,minute, 00)).getTime();
         }	    
     }
     else
     {   
         TempTime = new Date(ServerTime);    
         Today = new Date(TempTime.getFullYear(),TempTime.getMonth(),TempTime.getDate(),TempTime.getHours(),TempTime.getMinutes(),TempTime.getSeconds()+1);
         Todays_Year = Today.getFullYear() - 2000;
         Todays_Month = Today.getMonth() + 1;          
         //Convert both today's date and the target date into miliseconds.                           
         Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
                                 Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();                                                           
         Target_Date = (new Date(year, month, day, hour, minute, 00)).getTime();
     }                          
     //Find their difference, and convert that into seconds.                  
     Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
     
     if(Time_Left < 0)
        Time_Left = 0;
     
    
    //More datailed.
    days = Math.floor(Time_Left / (60 * 60 * 24));
    Time_Left %= (60 * 60 * 24);
    hours = Math.floor(Time_Left / (60 * 60));
    Time_Left %= (60 * 60);
    minutes = Math.floor(Time_Left / 60);
    Time_Left %= 60;
    seconds = Time_Left;
	if(ProgId!='0')
	{
		DivCounter="countdownSTR"+ProgId;
		DivCountertext="textcountSTR"+ProgId;
	}  		
	else
	{
		DivCounter="countdownSTR";
		DivCountertext="textcountSTR";
	}
    if(seconds < 10) Tseconds = "<td align='left' valign='top'><font class='TitlesLWhite'><b>0</b></font></td><td align='left' valign='top'><font class='TitlesLWhite'><b>" + seconds + "</b></font></td>";
    if(minutes < 10) Tminutes = "<td align='left' valign='top'><font class='TitlesLWhite'><b>0</b></font></td><td align='left' valign='top'><font class='TitlesLWhite'><b>" + minutes + "</b></font></td>";
	else 
	{
		Tminutes = "<td align='left' valign='top'><font class='TitlesLWhite'><b>" + Math.floor(minutes / (10)) + "</b></font></td><td align='left' valign='top'><font class='TitlesLWhite'><b>" + (minutes-Math.floor(minutes / (10))*10) + "</b></font></td>";
	}		
    if(hours < 10) Thours = "<td align='left' valign='top'><font class='TitlesLWhite'><b>0</b></font></td><td align='left' valign='top'><font class='TitlesLWhite'><b>" + hours + "</b></font></td>";
	else 
	{
		Thours = "<td align='left' valign='top'><font class='TitlesLWhite'><b>" + Math.floor(hours / (10)) + "</b></font></td><td align='left' valign='top'><font class='TitlesLWhite'><b>" + (hours-Math.floor(hours / (10))*10) + "</b></font></td>";
	}				
	if(days < 10) Tdays = "<td align='left' valign='top'><font class='TitlesLWhite'><b>0</b></font></td><td align='left' valign='top'><font class='TitlesLWhite'><b>" + days + "</b></font></td>";
	else 
	{
		Tdays = "<td align='left' valign='top'><font class='TitlesLWhite'><b>" + Math.floor(days / (10)) + "</b></font></td><td align='left' valign='top'><font class='TitlesLWhite'><b>" + (days-Math.floor(days / (10))*10) + "</b></font></td>";
	}		
	
    CoObj = eval($g(DivCounter));
	TextObj = eval($g(DivCountertext));
    if(CoObj)
    {
        StrCounter = "";
		if(ProgId!='0')
		{			
			StrCounter += "<table width='166' align='center' cellpadding='0' cellspacing='0' border='0'>"+	
							   "<tr><td height='3'></td></tr>"+
							   "<tr><td width='10'></td>";	
			StrCounter += Tdays + "<td width='14'></td>";
			StrCounter += Thours + "<td width='14'></td>";
			StrCounter += Tminutes;							   
			StrCounter += "</tr></table>";
		}
		else
		{
			StrCounter += "<table width='220' align='center' cellpadding='0' cellspacing='0' border='0'>"+	
							   "<tr><td width='32'></td>";	
			StrCounter += Tdays + "<td width='10'></td>";
			StrCounter += Thours + "<td width='10'></td>";
			StrCounter += Tminutes + "<td width='20'></td>";							   
			StrCounter += "</tr></table>";
		}
        CoObj.innerHTML = "";    
		CoObj.innerHTML += StrCounter;                 
        //Recursive call, keeps the clock ticking.
        if (days != 0 || hours != 0 || minutes != 0 || seconds != 0)
        {
			if(SetCount=='True')
			{
				TextObj.innerHTML = "<b>Next show is coming up in</b>";
            	countdownTimeout = setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + ProgId + ',"'+Today+'");', 1000);
			}
			else
			{
				 TextObj.innerHTML = "<b>No schedule is set for this show</b>";
			}
        }
        else
        {
            TextObj.innerHTML = "The show has just started ";
        }
   }                  
}

getBrowserType();    
	
function SetMyProgram(ProgramId, MyProgramStatus,TuserId)    
{
    SetMyProgramHpDiv(ProgramId,MyProgramStatus,TuserId, "");
    return;
	if(TuserId!=0)
	{
	    if(MyProgramStatus==0)
	    {   SPtitle='Remove from subscriptions';
	        SPimgSrc=IMG_SERVER_URL+'icon_minus.gif';        
	       	alertText = "The show has been added to your subscriptions";
		}
	    else
	    {
	        SPtitle='Subscribe';
	        SPimgSrc = IMG_SERVER_URL+'icon_plus.gif';
	        alertText = "The show has been successfully removed from your subscriptions.";
		}
	    var MyShow = document.getElementsByName("SetMyProgramTD"+ProgramId);
		var MyShowBtn = document.getElementsByName("SetMyProgramBtnTD"+ProgramId);
		for(i=0;i<MyShow.length;i++){
	    	if(MyShowBtn[i].getElementsByTagName('img')){
	    	    MyShowBtn[i].getElementsByTagName('img')[0].src=SPimgSrc;
	    	} 
	    	var links=MyShow[i].getElementsByTagName('a');
	    	for(j=0;j<links.length;links[j++]){
	    	    links[j].onclick=function(){SetMyProgram(ProgramId,1-MyProgramStatus);};
	    	    links[j].setAttribute('title',SPtitle);
	    	}
		}
	    SendMyProgramStatus(ProgramId, MyProgramStatus,TuserId);
	   
	}
	else
	{
		//blogtvAlert('In order to use this functionality please sign in to the site');
		logInDiv('In order to use this functionality please sign in to the site','');
	}
}

function SendMyProgramStatus(ProgramId, MyProgramStatus,TuserId){
     if(TuserId!=0){
        if (MyProgramStatus==0)
            bTV2N.LogAct("",ProgramId,219,"");
        var SR=ProgramId;
        url = "/Ajax/My_SetProgram.asp";
	    str = "ProgramId="+ProgramId+"&Status="+MyProgramStatus+"&SR="+SR+"&BR=0";
	    setObjXML();
	    objXML.open("POST", url ,false); 
	    objXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
	    objXML.send(str);
		blogtvAlert(alertText);
	 }
}

function SetVodPlayList(VodId, Status,TuserId)
{
	if(TuserId!=0)
	{	
	    url = "/Ajax/My_SetVodPlayList.asp";    
	    if (window.XMLHttpRequest)
	        objXML = new XMLHttpRequest();
	    else 
	    {
	        ie = true;
	    	objXML = new ActiveXObject("Microsoft.XMLHTTP");
	    }
	    objXML.open("POST", url ,true); 
	    objXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');    
	    objXML.send("VodId="+VodId+"&Status="+Status);
	    if(Status==0)
	    {
	        BtnStr = "<img src='"+IMG_SERVER_URL+"icon_minus.gif' width='19' height='19' alt='' border='0'><br>";        
	        HtmlStr = "<a onclick=SetVodPlayList('"+VodId+"',1); class='F11 LH12 FB C_GD UnLine' title='Remove from favorites'>MY FAVORITES</a>";
	    	alertText = "The show has been added to your favorites";
	    	bTV2N.LogAct(TuserId,VodId,4,"");
		}
	    else
	    {
	        BtnStr = "<img src='"+IMG_SERVER_URL+"icon_plus.gif' width='19' height='19' alt='' border='0'><br>";
	        HtmlStr = "<a onclick=SetVodPlayList('"+VodId+"',0); class='F11 LH12 FB C_GD UnLine' title='Add to favorites'>MY FAVORITES</a>";
	    	alertText = "The show has been removed from your favorites";
		}
		var MyVodPList = document.getElementsByName("MyVodPListTD_"+VodId);
		var MyVodPListBtn = document.getElementsByName("MyVodPListBtnTD_"+VodId);
		for(i=0;i<MyVodPList.length;i++)
		{
	    	MyVodPList[i].innerHTML = HtmlStr;    
		    MyVodPListBtn[i].innerHTML = BtnStr;
		}
		blogtvAlert(alertText);
	}
	else
	{
		//blogtvAlert('In order to use this functionality please sign in to the site');
		logInDiv('In order to use this functionality please sign in to the site','');
	}
}

function OpenChat(ProgramId)
{
    var win = window.open(IIS_SERVER_URL + "/Flash/Objects/BlogTvPlayerPanel.asp?programId="+ProgramId,"StartBrodcast","toolbar=0,location=0,directories=0,status=yes,menubar=0,scrollbars=0,resizable=0,width=780,height=628");  
    if(win)
    {
        win.focus();        
    }
    else
    {
        alert("Sorry, your browser did not allow the broadcasting window to open");
    }        
}
function OpenChatR(ProgramId)
{    
    window.location = IIS_SERVER_LINK + "SpreadTheWord.asp?" + "ProgramId=" + ProgramId;
    /*
    var RefStr="";
    if(HomePageFlag==1) RefStr="&ref=BroadcastHp";
    var win = window.open(IIS_SERVER_URL + "/Flash/Objects/BlogTvRecorderPanel.asp?programId="+ProgramId+RefStr,"StartBrodcast","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=780,height=628");
    if(win)
       win.focus();        
    else
         alert("Sorry, your browser did not allow the broadcasting window to open");      
    */     
}

// This Limit Text Input Or TeatArea Str
function checkStrCount(str,MaxLen,BR,e)
{
    var key = window.event ? e.keyCode : e.which;    
    if(key!=8 && key!=0)
    {               
        TempStr = str.split(String.fromCharCode(13)+String.fromCharCode(13));
        if (TempStr == "" )
            TempBR = 0;
        else
            TempBR = TempStr.length;

        if(TempBR>BR+1)
            return false;
            
        if ((str.length-TempStr.length) >= MaxLen)
            return false;
        else
            return true;
     }
     else
         return true;
}

//showing My-Shows list in the My Bar
var STO;
function ShowMyShows(toOpen)
{
    var obj = $g("divPannelMyShows");
    if (toOpen){
        obj.style.display = "block";
        STO = setTimeout('ShowMyShows(false)',3000);
    }else{
        obj.style.display = "none";
        clearTimeout(STO);
    }
}

//Hide My-Shows list in the My Bar
function HideMyShows()
{
	$g("frShows").style.display = "none";
	$g("MyShowsDiv").style.display = 'none';
}

//showing the channels list in the header
function ShowChannels(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else if (obj.x) curleft += obj.x;
	$g("frTest").style.display = "inline"; 
	$g("frTest").style.left=curleft;	
	$g("frTest").style.zindex=4;
	$g("channelType").style.zindex=100;
	$g("channelType").style.left=curleft;	
	$g("channelType").style.display='block';
}

function ShowRecorded(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else if (obj.x) curleft += obj.x;
	
	$g("recordedType").style.zindex=100;
	$g("recordedType").style.left=curleft;	
	$g("recordedType").style.display='block';
}

//This function changing the font color of the channels list in the header
function HideChannels()
{
	$g("frTest").style.display = "none";
	$g("channelType").style.display='none';
}

function HideRecorded()
{
	$g("recordedType").style.display='none';
}


function ChangeFont(obj,act,Tname)
{
	if(act==1)
	{
		obj.style.color='#FD9800';
		$g(Tname).style.backgroundColor='#404040';
	}
	else if(act==2)
	{
		obj.style.color='#CCCD33';
		$g(Tname).style.backgroundColor='#333333';
	}
}

//Pop Alert With Live Embed
function GetLiveEmbed()
{
    $g("LiveEmbedDiv").style.display='';	    
}
///////////////// SYS IMAGES ////////////////////////
function ShowFigure()
{
    FigureDivObj = $g("ShowFigureDiv");
    if(FigureDivObj.style.display=="none")
        FigureDivObj.style.display = "block";
    else    
        FigureDivObj.style.display = "none";
} 
  
function setSysImage(ImgSrc,ImgId)
{
    $g("ImgName").src = "";       
    $g("TheImg").src = ImgSrc;    
    $g("ImgId").value = ImgId;
    $g("TheImg").style.display = "block";
}

///////////////// SYS IMAGES ////////////////////////

////////////////  Info Tip //////////////////////////
function ShowInfo(num,e)
  { switch(num)
    {   case 0:
            Msg = "";
            break;
        case 1:
            Msg = "Everyone will see your username so make it a good one!";
            break;  
        case 2:
            Msg = "Your email address will only enable us to contact you in times of trouble or in times of really cool news. What if you win the blogTV dancerama contest?       Don&#39;t worry, we won&#39;t spam you.";
            break; 
        case 3:
            Msg = "No one will see your password but you. Just make it something you will remember.";
            break; 
        case 4:
            Msg = "Enter it again to be sure.";
            break; 
        case 5:
            Msg = "This brings us all closer to knowing who we really are (or who we&#39;d like to be). It&#39;s also good for our research.";
            break;     
        case 6:
            Msg = "This feature makes it more complicated for you to lie if you&#39;re underage.";
            break; 
        case 7:
            Msg = "Your zip/postal code is required so we can fill in your time zone. It also helps for password retrieval if you ever forget your password. And again, it couldn&#39;t hurt our research.";
            break; 
        case 8:
            Msg = "This is just to validate your form.";
            break; 
        case 9:
            Msg = "This profile data is collected to facilitate searching and finding users and communicating with the community. It fosters and facilitates user interaction in the blogTV.com social networking community. We will have sponsored contests on blogTV.com and users will be asked for personal information which includes your first and last name. This information is not visible to other users unless you choose to make it visible.";
            break; 
        case 10:
            Msg = "This profile data is collected to facilitate searching and finding users and communicating with the community. It fosters and facilitates user interaction in the blogTV.com social networking community. We will have sponsored contests on blogTV.com and users will be asked for personal information which includes your first and last name. This information is not visible to other users unless you choose to make it visible.";
            break;
        case 11:
            Msg = "We collect this profile data to facilitate searching and finding users and communicating with the community. blogTV.com will have sponsored contests on our site and users will be asked for personal information which may include your state. We also collect this data for purposes including running online metrics to determine website usage based on user profile information. This information is not visible to other users unless you choose to make it visible.";
            break;  
        case 12:
            Msg = "We collect this profile data to facilitate searching and finding users and communicating with the community. blogTV.com will have sponsored contests on our site and users will be asked for personal information which may include your city. This information is not visible to other users unless you choose to make it visible";
            break; 
        case 13:
            Msg = "We collect this profile data to facilitate searching and finding users and communicating with the community.";
            break; 
        case 14:
            Msg = "";
            break; 
        case 15:
            Msg = "We collect this profile data to facilitate searching and finding users and communicating with the community. This information is always visible to other users.";
            break;     
        case 16:
            Msg = "We collect this profile data to facilitate searching and finding users and communicating with the community. This information is always visible to other users.";
            break; 
        case 17:
            Msg = "We collect this profile data to facilitate searching and finding users and communicating with the community. This information is always visible to other users.";
            break; 
        case 18:
            Msg = "We collect this profile data to facilitate searching and finding users and communicating with the community. This information is always visible to other users.";
            break;
        case 19:
            Msg = "We collect this profile data to facilitate searching and finding users and communicating with the community. This information is always visible to other users.";
            break;
        case 20:
            Msg = "We collect this profile data to facilitate searching and finding users and communicating with the community. This information is always visible to other users.";
            break;
        case 21:
            Msg = "We collect this profile data to facilitate searching and finding users and communicating with the community. This information is always visible to other users.";
            break;  
        case 22:
            Msg = "We collect this profile data to facilitate searching and finding users and communicating with the community. This information is always visible to other users.";
            break;
        case 23:
            Msg = "This rating represents the average of all ratings that have been given by users.";
            break;
        case 24:
            Msg = "Enter it again to be sure ";
            break; 
        case 25:
            Msg = "We collect this profile data to facilitate searching and finding users and communicating with the community. blogTV.com will have sponsored contests on our site and users will be asked for personal information which may include your state. We also collect this data for purposes including running online metrics to determine website usage based on user profile information. This information is not visible to other users unless you choose to make it visible.";
            break;
        default:  
            Msg = "";
            break;    
    }
    TblStr = "" +     
    "<table class='BGGLL' width='220' height='150' align='center' cellpadding='4' cellspacing='4' border='0'>" +    
    "<tr>" +
        "<td valign=top>" +
            Msg + 
        "</td>" + 
    "</tr>" + 
    "</table>";

    x = xPageX(e);
    y = xPageY(e);
            
    if ($g("showInfo_"+num))
    {   $g("showInfo_"+num).src = IMG_SERVER_URL + "/Info_Over.gif";
    }
    if ($g("divInfo"))
    {   $g("divInfo").innerHTML = TblStr;        
        $g("divInfo").style.left = x + 20;   
        $g("divInfo").style.top = y - 20;
        $g("divInfo").style.display = "block";
    }    
}
//////////////
function xPageY(e)
{   var y = 0;
    while (e) 
    {   if (xDef(e.offsetTop)) y += e.offsetTop;
        e = xDef(e.offsetParent) ? e.offsetParent : null;
    }
    return y;  
}

function xPageX(e)
{   var x = 0;
    while (e) 
    {   if (xDef(e.offsetLeft)) x += e.offsetLeft;
        e = xDef(e.offsetParent) ? e.offsetParent : null;
    }
    return x;
}

function xDef()
{   for(var i=0; i<arguments.length; ++i)
    {   if(typeof(arguments[i])=='undefined') 
        {   return false;
        }
    }
    return true;
}

/////////////
function HiddeInfo(num)
{   if ($g("showInfo_"+num))
    {   $g("showInfo_"+num).src = IMG_SERVER_URL + "/Info.gif";
    }
    if ($g("divInfo"))
    {   $g("divInfo").style.display = "none"; 
    }
}
////////////////  Info Tip //////////////////////////

var FlagsArr = new Array(5);
    FlagsArr[0] = false;
    FlagsArr[1] = false;
    FlagsArr[2] = false;
    FlagsArr[3] = false;
    FlagsArr[4] = false;
    FlagsArr[5] = false;
    function clearMe(obj)
    {   
        if(FlagsArr[obj.name]==false)
        {   
            obj.value = "";
            FlagsArr[obj.name]=true;
        }
    }
    function SetClearMeArr()
    {                  
        for(ArrCount=0;ArrCount<FlagsArr.length; ArrCount++)
        {
            FlagsArr[ArrCount] = false;
        }       
    }
    
///////////////// Login /////////////////////////////
var insertFlag = 'false';
function claerMe(obj)
{    
    if (insertFlag == 'false') 
    {
        obj.value = ''; 
        insertFlag = 'true';
    }
}
var insertTextFlag;
function claerText(obj,flag)
{    
    if (flag == 'false'&&insertTextFlag != 'true') 
    {
        obj.value = ''; 
        insertTextFlag = 'true';
    }
}

//===
var _Backurl = "";
function Login(backurl)
{   
   _Backurl = backurl;
   if (_Backurl == 1 || _Backurl == 4 || _Backurl == 6 || _Backurl == 16)
   {
       LoginName="divUserName";
       LoginPsw="divUserPsw";
       LoginRemember=true;
       if(_Backurl==6)
       {
           _LogInLocation=6;
       }    
   }
   else if (_Backurl==7)
   {
       _LogInLocation=7;
       LoginName="UserName";
       LoginPsw="UserPsw";
       LoginRemember = $g("RememberMe").checked;
   }
   else
   {
       LoginName="UserName";
       LoginPsw="UserPsw";
       LoginRemember = $g("RememberMe").checked;
   }
   LoginName = $g(LoginName).value;
   LoginPsw = $g(LoginPsw).value;   
   if(LoginRemember)
   {
        LoginRemember = 1;
   }     
   else
   {
        LoginRemember = 0;
   }     
   
   if(LoginName == "" || LoginName == "User Name") 
   { 
        if (_Backurl == 1 || _Backurl == 4 || _Backurl == 6 || _Backurl == 16)
           $g("divLoginErr").innerHTML="Please enter a username";
        else
            blogtvAlert("Please enter a username");
	    return false;
   }
   
   if (LoginPsw == "" || LoginName == "Password")
   {
     if (_Backurl == 1 || _Backurl == 4 || _Backurl == 6 || _Backurl == 16)
        $g("divLoginErr").innerHTML="Please enter a password";
     else
        blogtvAlert("Please enter a password");
	 return false;
   } 
   
   xmlPage = "/Ajax/Users_Login.asp";
   parm = "UserName="+LoginName+"&UserPsw="+encodeURIComponent(LoginPsw)+"&RememberMe="+LoginRemember+"&LogInLocation="+_LogInLocation+"&BackUrl="+encodeURI(backurl);
   setObjXML();
   objXML.open("POST", xmlPage ,true); 
   objXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
   objXML.onreadystatechange = CheckUserLogin;
   objXML.send(parm);
}

function CheckUserLogin()
{
    if (objXML && objXML.readyState==4)
	{
        if (objXML.responseXML)
		{   
		    var UserBlock1 = objXML.responseXML.getElementsByTagName("UserBlock");                
                _UserBlock1 = UserBlock1[0].firstChild.data; 
            var UserStatus = objXML.responseXML.getElementsByTagName("UserStatus");                
                _UserStatus = UserStatus[0].firstChild.data; 
            var MyStr = objXML.responseXML.getElementsByTagName("Str");                
                _MyNav= MyStr[0].firstChild.data;
            var MyErrStr = objXML.responseXML.getElementsByTagName("ErrStr");                
                _MyErrStr = MyErrStr[0].firstChild.data;    
            var UserName = objXML.responseXML.getElementsByTagName("UserName");                
                _UserName = UserName[0].firstChild.data;
            var UserId = objXML.responseXML.getElementsByTagName("UserId");                
                _UserId = UserId[0].firstChild.data; 
            var Activate = objXML.responseXML.getElementsByTagName("Activate");                
                _Activate = Activate[0].firstChild.data;                
            if (_UserBlock1 == 2)
            {
                window.open("/Notification.asp?msg=7&BUN="+_UserName,"_parent");  
            }
            else
            {
                if (_Activate == 0 && _UserStatus==3)                
                {                       
                    if(_LogInLocation==2)
                    {  
                       var win = window.open("/Notification.asp","");  
                       win.focus();                     
                    }
                    else
                    {   window.location.href = "/Notification.asp";
                    }
                }    
                if (_UserStatus!=3)
                {                       
                    if(_UserStatus==0 && _MyErrStr != "")
                    {				        
				        if (_Backurl == 0 || _Backurl==7){
			                insertFlag = 'false';
                            $g("divMyPannel").innerHTML  = _MyErrStr;	
                            setTimeout("writeMy();",2500);
                        }else if(_Backurl == 1 || _Backurl == 4 || _Backurl == 6 || _Backurl == 16){
                            insertFlag = 'false';
                            $g("divLoginErr").innerHTML  = _MyErrStr;
                        }else{
                            insertFlag = 'false';
                            $g("MyDiv").innerHTML  = _MyErrStr;	
                            setTimeout("writeMy();",2500);
                        }
                    }
                    else
                    {    
                        UpdateToolbar();                       
                        if(_LogInLocation==3)
                        {  
                            window.location.href=PARENT_URL+'ForumLoginRefreshPage.asp';
                        }
                        else if (_Backurl == 16 || _Backurl == 4)
                        {
                            window.location.reload();
                        }
                        else
                        {
                             bTV2N.LogAct(_UserName,"",82,""); 
                             if (_Backurl==1){
                                //$g("MyDiv").innerHTML = myStr;
                                setCustomAlertInnerHTML(GetDivInnerHTML(0));
                             }
                             else if(_Backurl==6){
                                //$g("MyDiv").innerHTML = myStr;
                                
                                 var JSShows = objXML.responseXML.getElementsByTagName("JSShows");                
                                 tmpAr = JSShows[0].firstChild.data.split(","); 
                                 if (tmpAr[0]!=""){
                                     for(var i=0;i<tmpAr.length;i++)
                                        myShowsAr[i]=tmpAr[i];
                                 }else{
                                    myShowsAr=new Array();
                                 }
                                 var JSTimeZone = objXML.responseXML.getElementsByTagName("JSTimeZone");                
                                 jsUserTimeZone=JSTimeZone[0].firstChild.data; 
                                CookieUserName=_UserName;
                                
                                if (myShowsAr.length>0){
                                    setCustomAlertInnerHTML(GetDivInnerHTML(7));
                                    show_calendar("Schedule_Date", "","divCal");  
                                    goToScheduleStep(0);
                                }else{
                                    setCustomAlertInnerHTML(GetDivInnerHTML(8));
                                    CreateShow(0);
                                }
                             }                            
                             else if(_Backurl==0 || _Backurl==7)
                             {
                                window.location.reload();
                             }       
                             else if(_Backurl == 8)       
                             {
                                window.location.href = "/";
                             }
                             else
                             {
                                window.location.href = _Backurl;
                             }
                        }
                    }
                     
                 } 
              }   
        }
    }
}
function UpdateToolbar()
{
    if ("createEvent" in document) {
        var element = document.createElement("blogtvdata");
            element.setAttribute("updateTB", "1");
            document.documentElement.appendChild(element);
        var ev = document.createEvent("Events");
            ev.initEvent("blogtv_tbEvent", true, false);
            element.dispatchEvent(ev);            
    }    
}

function writeMy(){
    if($g("divMyPannel"))
    {
        $g("divMyPannel").innerHTML = _MyNav;
    }    
    else if(($g("MyDiv")))
    {        
        $g("MyDiv").innerHTML = _MyNav;
    }
}
///////////////// Login /////////////////////////////

////////////////  My Check Msgs ////////////////////////

function GlobalCheckNewMsgs()
{     xmlPage = "/Ajax/My_GetMy.asp";
    objMsgXml=CreateObjXML();
    objMsgXml.open("POST", xmlPage ,true); 
    objMsgXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objMsgXml.onreadystatechange = MyCheckUserMsgs;
    objMsgXml.send("");   
}

function MyCheckUserMsgs()
{     if (objMsgXml && objMsgXml.readyState==4)
  {     if (objMsgXml.responseXML)
      {     var TotalMsgs = objMsgXml.responseXML.getElementsByTagName("TotalMsgs");                
                _TotalMsgs = TotalMsgs[0].firstChild.data;  
            if($g("MyMsgCount"))
                {   var MyMsgCount;  
                    if(_TotalMsgs > 0){     
                        $g("MsgImg_envelope").src = IMG_SERVER_URL+"Blink_envelope.gif";
                        MyMsgCount="New: " + _TotalMsgs;
          		      }else{     
          		        $g("MsgImg_envelope").src = IMG_SERVER_URL+"icon_envelope.gif";
          		        MyMsgCount="0";
                      }
                      $g("MyMsgCount").innerHTML = MyMsgCount;
                }
          }
    }
}

//////////////// My Check Msgs ////////////////////////

////////////////  My Check Authorize Waiting ////////////////////////
function CheckAuthorizeWaiting(Programid)
{     parm = "ProgramId="+Programid;
    xmlPage = "/Ajax/My_GetAuthorizeWaitingCount.asp";
    objAuthorizeXml = CreateObjXML();
    objAuthorizeXml.open("POST", xmlPage ,true); 
    objAuthorizeXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objAuthorizeXml.onreadystatechange = MyCheckAuthorizeWaiting;
    objAuthorizeXml.send(parm);   
}

function MyCheckAuthorizeWaiting()
{     if (objAuthorizeXml && objAuthorizeXml.readyState==4)
  {     if (objAuthorizeXml.responseXML)
      {     var TotalWaiting = objAuthorizeXml.responseXML.getElementsByTagName("AuthorizedWaiting");                
                _TotalWaiting = TotalWaiting[0].firstChild.data;  
            if($g("MyAutrizeCount"))
                {     if(_TotalWaiting>0)
                      {     $g("AutrizeImg_envelope").src = IMG_SERVER_URL+"Blink_envelope.gif";
          		}
                      else
                      {     $g("AutrizeImg_envelope").src = IMG_SERVER_URL+"icon_envelope.gif";
                      }
                      $g("MyAutrizeCount").innerHTML = _TotalWaiting;
                }
          }
    }
}

//////////////// My Check Authorize Waiting ////////////////////////

////////////// Search /////////////////////////
function ChangeDrobBox(searchChannel)
{
   if(searchChannel!="")
   {
       xmlPage = "/Ajax/Search_GetSubChannel.asp";
       parm = "C="+searchChannel+"&w="+CurrentUrl+"&channel="+ChannelIdSearch+"&param="+param+"&programflag="+programflag;
       setObjXML();
       objXML.open("POST", xmlPage ,true); 
       objXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
       objXML.onreadystatechange = channelSerarch;
       objXML.send(parm); 
    }
    else
    {
        blogtvAlert("Please pick a search channel");
        return;
    }
}

function ChangeChannelDrobBox(searchChannel)
{
   if((searchChannel!="")&&($g("MainSearch").value!=""))
   {
       xmlPage = "/Ajax/Search_GetSubChannel.asp";
       parm = "C="+$g("MainSearch").value+"&w="+CurrentUrl+"&channel="+searchChannel+"&param="+param+"&programflag="+programflag;
       setObjXML();
       objXML.open("POST", xmlPage ,true); 
       objXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
       objXML.onreadystatechange = channelSerarch;
       objXML.send(parm); 
	}
    else
    {
        blogtvAlert("Please pick a search channel");
        return;
    }
}

function channelSerarch()
{
    if (objXML && objXML.readyState==4)
    {
        if (objXML.responseXML)
        {   
             var SubSearhChannel = objXML.responseXML.getElementsByTagName("Str");               
             $g("SubSearchDiv").innerHTML = SubSearhChannel[0].firstChild.data;                
        }
    }
}


////////////// Search /////////////////////////

////////////// Invite To Close Show /////////////////////////
function ChangeBoxStatus(Status)
{    
   if($g("flsObj"))
   {
   		flashObj = $g("flsObj").innerHTML;
   }
   xmlPage = "/Ajax/Program_BoxDetails.asp";
   parm ="ProgramId="+_ProgramId+"&Status="+Status; 
   setObjXML();
   objXML.open("POST", xmlPage ,true);    
   objXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
   objXML.onreadystatechange = ProgramDetailsChange;
   objXML.send(parm);
}

function ProgramDetailsChange()
{
    if (objXML && objXML.readyState==4)
    {
        if (objXML.responseXML)
        {             
             var ProgId = objXML.responseXML.getElementsByTagName("ProgramId"); 
             var Pid = ProgId[0].firstChild.data; 
             var Tdate = objXML.responseXML.getElementsByTagName("Tdate"); 
             var Tdate = Tdate[0].firstChild.data; 
             if (Tdate=='False') Tdate='';            
             var ProgramDetails = objXML.responseXML.getElementsByTagName("Str");                           
             $g("CloseShowDiv"+Pid).innerHTML = ProgramDetails[0].firstChild.data; 
			 var CountTime = objXML.responseXML.getElementsByTagName("ProY");
			 if($g("flsObj")&&(flashObj!=""))
			 {
			  	$g("flsObj").innerHTML=flashObj;
			 }			 
			 if (CountTime[0].firstChild.data!='False')
			 {			 	
			 	ProY=CountTime[0].firstChild.data;
				var ProM = objXML.responseXML.getElementsByTagName("ProM");
				ProM=ProM[0].firstChild.data;
				var ProD = objXML.responseXML.getElementsByTagName("ProD");
				ProD=ProD[0].firstChild.data;
				var ProH = objXML.responseXML.getElementsByTagName("ProH");
				ProH=ProH[0].firstChild.data;
				var ProMi = objXML.responseXML.getElementsByTagName("ProMi");
				ProMi=ProMi[0].firstChild.data;
    			SetCount='True';
            	countdown(ProY,ProM,ProD,ProH,ProMi,'0',Tdate);
			 }       
        }
    }
}

function CheckUserBox()
{
    RUserName = $g("YourName").value;
    RUserPass = $g("YourPass").value;
    xmlPage = "/Ajax/Program_CloseShowLogin.asp";
    parm ="ProgramId="+_ProgramId+"&YourName="+RUserName+"&YourPass="+RUserPass; 
    setObjXML();
    objXML.open("POST", xmlPage ,true);    
    objXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objXML.onreadystatechange = ProgramDetailsChange;
    objXML.send(parm);
}

function CloseShowRequest()
{    
    _RUserId = $g("RUserId").value;
    _ReasonStr = encodeURI(SetSpaces($g("Reason").value,15));
    xmlPage = "/Ajax/Program_CloseShowRequest.asp";
    parm = "ProgramId="+_ProgramId+"&RUserId="+_RUserId+"&R="+_ReasonStr;    
    setObjXML();
    objXML.open("POST", xmlPage ,true); 
    objXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objXML.onreadystatechange = ProgramDetailsChange;
    objXML.send(parm);
}
////////////// Invite To Close Show /////////////////////////

/////////////   Send Program To Friends////////////////
function CheckEmails(Str)
{
    Email = new String(Str);
    if(Email.indexOf("@")==-1 || Email.indexOf(".")==-1 || Email.indexOf(String.fromCharCode(34))>-1)
	{
        return true;
	}
    else
    {   
        return false;
    }
}

function SendToFriends(Status)
{    
    _SenderName = $g("YourName").value;
    _SendTo = new String($g("SendTo").value);
    while(_SenderName.indexOf("--")!=-1)
    {
       _SenderName = _SenderName.replace(/--/,"- -");
    }
    //alert(_SenderName);
    if(_SenderName=="")
    {
        blogtvAlert("ENTER YOUR NAME");
        return false;        
    }      
        
    GoodEmail = "";
    BadEmail = "";
    
    if(_SendTo=="")
    {
        blogtvAlert("Please enter recipient e-mail");
        return false;        
    }
    TempEmail = _SendTo.split(",");
    for(i=0;i<TempEmail.length;i++)
    {
        if(TempEmail[i]!="")
        {
            if(CheckEmails(TempEmail[i]))
            {  
                BadEmail += TempEmail[i] +",";
            }
            else
            {
                GoodEmail += TempEmail[i] +",";
            }
        }
    }
    if(BadEmail!="")
    {
        if(blogtvConfirm("Would you like to change the incorrect e-mails:"+BadEmail))
        {
            return false;
        }
    }
    if(Status==3)
    {
        xmlPage = "/Ajax/Email_ProgramSendToFriend.asp";
        parm = "ProgramId="+_ProgramId+"&SE="+escape(_SenderName)+"&SN=&ST="+GoodEmail;
        bTV2N.LogAct("",_ProgramId,220,"");
    }
    else
    {
        xmlPage = "/Ajax/Email_VodSendToFriend.asp";
        //parm = "VodName="+escape(_VodName)+"&VodLink="+_vodlink+"&SE="+_SenderName+"&SN="+_SenderEmail+"&ST="+GoodEmail;
        parm = "VodId="+PlayedVod+"&SE="+encodeURI(_SenderName)+"&SN=&ST="+GoodEmail+"&VodLink="+_vodlink;
        bTV2N.LogAct("",PlayedVod,220,"");
    }    
    objXML = CreateObjXML();

    objXML.open("POST", xmlPage ,true); 
    objXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    if(Status==3)
    {
        objXML.onreadystatechange = ProgramDetailsChange;
    }
    else
    {
        objXML.onreadystatechange = VodSendChange;
    }    
    objXML.send(parm);
    
}

/////////////   Send Program To Friends////////////////
/////////////   Send Vod To Friends////////////////
function SendVodToFriendsDiv(Status)
{   
    //stsus: 0-ShowVodsPage.asp; 1- ShowVodsListPage.asp//
    if(Status==0)
    {   
		if(TagId!="")
		{
			_vodlink = "shows/"+_ProgramId + "/Tags/" + TagId + "/" + PlayedVod + "^pos=ancr";
		}
		else
		{    
        	_vodlink = "shows/"+_ProgramId+"/"+PlayedVod+"^pos=ancr";
		}
    }    
	else if(Status==2)
	{
		_vodlink = "ShowVodsListPage.asp?VodId="+PlayedVod+"^page="+ListPage+"^SearchChannel="+SearchChannel+"^SubSearch="+SubSearch+"^Userpic="+Userpic+"^online="+Sonline+"^Searchfrom="+Searchfrom+"^searchparam="+Searchparam+"^SearchStr="+SearchStr+"^S="+VodSortBy+"^pos=ancr";
	}    
    else
    {
        _vodlink = "ShowVodsListPage.asp?VodId="+PlayedVod+"^page="+ListPage+"^list="+List+"^s="+VodSortBy+"^param="+ShareParam+"^pos=ancr";
    }  
    
    var MailToVodlink = _vodlink;
    while(MailToVodlink.indexOf("^")>0)
    {
        MailToVodlink = MailToVodlink.replace("^","%26");
    }
        if(userName==' Guest') userName='';
	   Str = ""+
	   "<table align='center' width='410' cellpadding='0' cellspacing='4' border='0'>"+
	   "<tr><td height='5' colspan='2' colspan='2'></td></tr>" +
       "<tr>"+
            "<td valign='top' width='100'>"+
                "<span class='F12 LH12 C_GD'>Enter your name:</span>"+
            "</td>"+
       "</tr>" +
       "<tr>"+
            "<td valign='top' width='120' colspan='2'>"+
                "<input type='Text' id='YourName' name='YourName' value='"+userName+"' class='verysmall' />"+
            "</td>"+
       "</tr>" +
       "<tr><td height='5' colspan='2'></td></tr>" +
       "<tr>"+
            "<td colspan='2' valign='top'>"+
                "<span class='F12 LH12 C_GD'>Your friends&#39; e-mail:</span><br>"+
                "<textarea id='SendTo' name='SendTo' class='verySmall' onkeypress='return isEnglishAndSigns4Emails(event)|| isNumber(event);'></textarea>"+
            "</td>"+
       "</tr>" +
       "<tr><td height='5' colspan='2'></td></tr>" +
       "<tr>"+
            "<td valign='top'>"+
                "<span class='F12 LH12 C_GD'>Please separate addresses by commas</span>"+
            "</td>"+
            "<td valign='top'>" +
                "<div class='posRel'>";                
                    Str = Str + writeBlackButtonJS(94,"SEND","SendToFriends("+Status+");");
                Str = Str + 
                "</div>" +    
	        "</td>"+
      "</tr>" +
      "<tr><td height='5' colspan='2'></td></tr>" +
      "<tr>"+
            "<td colspan='2' valign='top'>"+
                "<span class='F12 LH12 C_GD'><a class='F12 LH12 C_GD' href='mailto:?body= %0A "+IIS_SERVER_LINK+MailToVodlink+"' target='_blank'>Click here</a> </span>"+
            "</td>"+
       "</tr>" +
	  "</table>"+
	  "<div id='ShareVodNote'></div>";
	$g("VodCommentDiv").innerHTML = Str;
    $g("CommentDivTitle").innerHTML = "&nbsp;&nbsp;<b class='F12 LH12 C_GD UCase'>share it</b>";	
    if(Reviews>0)
    {	
	    $g("BackCommentDivTitle").style.display='block';
	}
	else
	{
	    $g("BackCommentDivTitle").style.display='none';
	}
}

function VodSendChange()
{
     if (objXML && objXML.readyState==4)
    {
        if (objXML.responseXML)
        { 
            var VodStr = objXML.responseXML.getElementsByTagName("Str");
                _VodStr = VodStr[0].firstChild.data;
            Str = "<table align='center' width='410' cellpadding='0' cellspacing='4' border='0'>"+
        	"<tr><td height='50'></td></tr>" +
            "<tr><td valign='top' align='center'><font class='F12 LH12 FB C_GD'>"+_VodStr+"</font></td></tr>"+            
        	"</table><div id='ShareVodNote'></div>";           
            if($g("VodCommentDiv"))
               $g("VodCommentDiv").innerHTML = Str;
        }
    }
}
/////////////   Send Vod To Friends////////////////

function OpenIm(Imusr,Imusrname)
{
	if(CookieUsrId==0)
	{
		blogtvAlert("In order to use this functionality please sign in to the site!");
	}
	else
	{
		if(CookieUsrId!=Imusr)
		{
			try
			{
				window.MyIm.focus();
				window.MyIm.getBuddies();
				if(Imusr>0)
				{
					window.MyIm.openTempChat(Imusr,Imusrname,1);
				}
			}
			catch(err)
			{
				clearTimeout(OpenImRequset);
				dest = "/"+CookieFolder+"/im/imheader.asp?Imusr="+Imusr+"&Imusrname="+Imusrname;
				$g("ImMyFriendTd").style.backgroundColor='';
				MyIm = window.open(dest,"IM",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,height=420,width=305');					
			}
		}
		else
		{
			blogtvAlert("Sorry,but you cannot chat with your self!");
		}	
	}
}
/////////////   ALERTS ////////////////
function SetAlertDiv(Pid,Pname,Ststus,SFlag,SubApplicationId,AType,svrname,AWidth)
{
   if(userName=='')
   {
   		blogtvAlert("In order to use this functionality please sign in to the site!");
   }
   else
   {
       if((Pname=="")&&(Ststus=="")&&(SubApplicationId=="")&&(AType==""))
       {
           ProgId = Pid;
           severname = svrname;
           ScheduleFlag = SFlag;
           spaceFlag = 0;
       }
       else
       {
           ProgId = Pid;
           Ptitle = encodeURI(Pname);
           AlertStstus = Ststus;
           ScheduleFlag = SFlag;
           AlertSubApplicationId = SubApplicationId;
           AlertType = AType;
           AlertWidth = AWidth;
           severname = svrname;
           spaceFlag = 1;
       }
       if((AlertStr!="")&&(AlertPid!=0))
	        $g("AlertDiv"+AlertPid).innerHTML = AlertStr;
	   AlertStr = $g("AlertDiv"+Pid).innerHTML;
	   AlertPid= Pid;	   
       AlertobjXML = CreateObjXML();
       xmlPage = "/Ajax/Alerts_AlertRemindMe.asp";
       parm ="ProgramId="+ProgId+"&ProgramName="+Ptitle+"&AlertStstus="+AlertStstus+"&ScheduleFlag="+ScheduleFlag+"&AlertSubApplicationId="+AlertSubApplicationId+"&AlertType="+AlertType+"&severname="+severname+"&AlertWidth="+AlertWidth+"&spaceFlag="+spaceFlag; 
       AlertobjXML.open("POST", xmlPage ,true);    
       AlertobjXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
       AlertobjXML.onreadystatechange = AlertRemindMeChange;        
       AlertobjXML.send(parm);       
	}
}

function AlertRemindMeChange()
{
    if (AlertobjXML && AlertobjXML.readyState==4)
    {
        if (AlertobjXML.responseXML)
        {    
            var Str = AlertobjXML.responseXML.getElementsByTagName("Str");             
            _Str = Str[0].firstChild.data;              
            if (_Str=="False")
            {
                alert("Your email is not validated. Go to your profile page and check your email address");
            }
            else
            {
                var ProgId = AlertobjXML.responseXML.getElementsByTagName("ProgramId");                           
                var Pid = ProgId[0].firstChild.data; 
                $g("AlertDiv"+Pid).innerHTML = _Str;
            }
        }
    }
}

function CloseAlertDiv(Pid)
{
   $g("AlertDiv"+Pid).innerHTML = AlertStr;
   AlertPid= ""; 
   AlertStr = "";
}

function SetAlert()
{
    TriggerId = $g("Trigger").value; 
    if(TriggerId==0)
    {
        blogtvAlert("Please pick a reminder type!");
        return false;
    }    
    SubApplicationId = $g("SubApplication").value; ;
    ReffererId = $g("Refferer").value; 
    AlertId = $g("AlertType").value; 
    Title = escape($g("RefferTitle").value); 
    AlertWidth = $g("AlertWidth").value; 
    
    Ststus = $g("AlertStstus").value;
    if($g("severname").value!="")
    {
        severname = "";
    }
    
    xmlPage = "/Ajax/Alerts_SetAlert.asp";
    parm = "SubApplicationId="+SubApplicationId+"&ReffererId="+ReffererId+"&AlertId="+AlertId+"&TriggerId="+TriggerId+"&Title="+Title+"&AlertStatus="+Ststus+"&severname="+severname+"&spaceFlag="+spaceFlag+"&AlertWidth="+AlertWidth;
    if(Ststus==2)
    {
        // My BlogTV//
        xmlPage = "/Ajax/Alerts_SetMyBlogTvAlerts.asp";
        parm = "SubApplicationId="+SubApplicationId+"&AlertId="+AlertId+"&TriggerId="+TriggerId;        
    }    
    objXML = CreateObjXML();
    objXML.open("POST", xmlPage ,true); 
    objXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');

    if(Ststus!=2)
    {
        objXML.onreadystatechange = setAlertChange;
    }
    else
    {
        $g("AlertDiv"+ReffererId).innerHTML = AlertStr;
        AlertPid= ""; 
        AlertStr = "";     
    }
    objXML.send(parm);
    
}
function setAlertChange()
{
     if (objXML && objXML.readyState==4)
	{
        if (objXML.responseXML)
		{   
            var ProgId = objXML.responseXML.getElementsByTagName("ProgramId");                           
            var PId =  ProgId[0].firstChild.data;
            var AlertMsg = objXML.responseXML.getElementsByTagName("Str");                           
            $g("CloseShowDiv"+PId).innerHTML = AlertMsg[0].firstChild.data;                        
        }
    }   
}
/////////////   ALERTS ////////////////


////////////////////////// TopRated  ////////////////////// 
function changeTopRatedTab(rPeriod)
{
   xmlPage = "/Ajax/TopRated_GetRated.asp";		
   parm = "rPeriod="+rPeriod;
   objRateXml = CreateObjXML();
   objRateXml.open("POST", xmlPage ,true); 
   objRateXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
   objRateXml.onreadystatechange = TopRatedTab;
   objRateXml.send(parm);   
}
function TopRatedTab()
{
if (objRateXml && objRateXml.readyState==4)
	{
        if (objRateXml.responseXML)
		{   
			var TopRatedTabs = objRateXml.responseXML.getElementsByTagName("TopRatedTabs");
                TopRatedTabsStr = TopRatedTabs[0].firstChild.data;
            if($g("TopRatedTabsDiv"))
               $g("TopRatedTabsDiv").innerHTML = TopRatedTabsStr;              
            var ShowsStr = objRateXml.responseXML.getElementsByTagName("ShowsStr");
                _ShowsStr = ShowsStr[0].firstChild.data;
            if($g("TopRatedShowDiv"))
               $g("TopRatedShowDiv").innerHTML = _ShowsStr;                  
            var VodsStr = objRateXml.responseXML.getElementsByTagName("VodsStr");
                _VodsStr = VodsStr[0].firstChild.data;
            if($g("TopRatedVodDiv"))
               $g("TopRatedVodDiv").innerHTML = _VodsStr;              
        }
    }
}
////////////////////////// TopRated  //////////////////////
// ===============================================================
// showDialog(displayText)
// function gets two variables:
// displayText as string and dialogType as string,
// it displays a modal dialog with the displayText and
// there are three forms of dialog depending on
// the dialogType string:
// 'question' will display a question with 'yes' and 'no' 
//           buttons, it will return 1 or 0. 
// 'inform' will display an information message and 
//          will return 0.
// 'input' will display a text box for input and 
//         will return the input string or 0 if it's empty.
// the function uses the file  dialog.asp located in 
// 'includes' folder as the dialog window.
function isIEbrowser()
{
	if (window.ActiveXObject) 
		return 1;
	else
		return 0;
}

function blogtvConfirm(displayText)
{   return showDialog(displayText,"confirm");
}

function blogtvAlert(displayText)
{   showDialog(displayText, "alert");
}

function showDialog(displayText,dialogType)
{
    displayText = new String( displayText);
    displayTextFF = displayText.replace( /&#39;/gi, "'" );
    displayText = encodeURI(displayText.replace( /&#39;/gi, "'" ));
    
    
    // checking the input variables:
	if (typeof displayText == "undefined" || typeof dialogType == "undefined")
	{
	   alert("Javascript function showDialog() Error - function has to get 2 variables.");
	   return;
	}
    dialogType = dialogType.toLowerCase();
	// checking the dialogType string:
	// (must be 'question' , 'inform' or 'input'
	if (dialogType!="alert" && dialogType!="confirm" && dialogType!="input")
	{
	   alert("Javascript function showDialog() Error - dialogType value incorrect.");
	   return;
	}
	// checking the displayText string 
	// (can't be empty)
	if (displayText=="")
	{
	   alert("Javascript function showDialog() Error - displayText value can't be empty.");
	   return;
	}	

	if(isIEbrowser()) /// This is Internet Explorer browser:
	{
			// setting the features of the dialog box:
			/////////////////////////////////////////
			var dialogHeight = "280";
			var dialogWidth = "315";
			var scroll = "no";
			var resizable = "no";
			var help = "no";
			var status = "0";
			var dialogFeatures = "";
			var returnVal = 0;
			dialogFeatures = "dialogHeight:" + dialogHeight + "px";
			dialogFeatures += ";dialogWidth:" + dialogWidth + "px"; 
			dialogFeatures += ";scroll:" + scroll;
			dialogFeatures += ";help:" + help; 
			dialogFeatures += ";resizable:" + resizable;
			dialogFeatures += ";status:" + status;
			dialogFeatures += ";unadorned:no";
			/////////////////////////////////////////
			// opening the dialog box and getting the 
			// returned value:
			returnVal = window.showModalDialog("/Include/modalDialog/dialog.asp?dt="+dialogType+"&t="+displayText,window,dialogFeatures);
	}
	else /// Other browser:
	{   
	    switch (dialogType)
	    {
	        case "confirm":
	                returnVal = confirm(displayTextFF);
	                break;
	        case "alert":
	                alert(displayTextFF);
	                break;
	        case "input":
	                returnVal = prompt(displayTextFF);
	                break;
	    }
	}
	/////////////////////////////////////////
	// in any case, the returned value of this function 
	// will be 0, 1 or a string (not empty)
	if(typeof returnVal == "undefined" || returnVal == "")
		return false;
	else
		return returnVal;	
}

///////////// Recomended SHOW //////////////
function SetRecomendedProgram(ProgramId, status,TuserId)
{
	if(TuserId!=0)
	{
	    xmlPage = "/Ajax/Programs_SetRecomended.asp"; 
	    parm = "ProgramId="+ProgramId+"&Status="+status;
	    objRecXml = CreateObjXML();
        objRecXml.open("POST", xmlPage ,false); 
        objRecXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');        
        objRecXml.send(parm);   
        
	    if(status==0)
	    {
	        BtnStr = "<img src='"+IMG_SERVER_URL+"icon_minus.gif' onclick='SetRecomendedProgram("+ProgramId+",1)' width='19' height='19' alt='' border='0' class='class='CursorP''><br>";        
	        HtmlStr = "<a onclick='SetRecomendedProgram("+ProgramId+",1)' id='SetRecProgram' class='TitlesYellowB' title='Add Favorite'>Add Favorite</a>";
	    	alertText = "The show has been added to your favorite shows";
	    	NewHtmlStr = "<a onclick='SetRecomendedProgram("+ProgramId+",1,"+TuserId+")' class='F12 FB userLinkColor UnLine CursorP' title='Remove Favorite'>Remove Favorite</a>";
	    	bTV2N.LogAct(_ownerUserName,_ownerUserName,4,"");
	    	btnRecStr = "Remove Favorite"
	    	
		}
	    else
	    {
	        BtnStr = "<img src='"+IMG_SERVER_URL+"icon_plus.gif' onclick='SetRecomendedProgram("+ProgramId+",0)' width='19' height='19' alt='' border='0' class='class='CursorP''><br>";
	        HtmlStr = "<a onclick='SetRecomendedProgram("+ProgramId+",0)' id='SetRecProgram' class='TitlesYellowB' title='Recommend this show'>Add Favorite</a>";
	    	alertText = "The show has been removed from your favorite shows";
	    	NewHtmlStr =  "<a onclick='SetRecomendedProgram("+ProgramId+",0,"+TuserId+")' class='F12 FB userLinkColor UnLine CursorP' title='Recommend this show'>Add Favorite</a>";
	    	btnRecStr = "Add Favorite"
		}   
		    
	    if($g("FavoriteBtn")){
		   $g("FavoriteBtn").innerHTML = btnRecStr;		   
		   $g("FavoriteBtn").onclick = function(){SetRecomendedProgram(ProgramId,1-status,TuserId)};
		   $g("FavoriteBtn").title = btnRecStr;
		}	
		if($g("RecomendedTd")){
	        $g("RecomendedTd").innerHTML = HtmlStr;}
	    if($g("RecomendedIconTd")){
	        $g("RecomendedIconTd").innerHTML = BtnStr;}
	    if($g("FavShowDiv")){
	        $g("FavShowDiv").innerHTML = NewHtmlStr;}
	    blogtvAlert(alertText);
	}
	else
	{
		blogtvAlert('In order to use this functionality please sign in to the site');
	}		
}
///////////// Recomended SHOW //////////////

function OpenNewShow(MaxNum,Num)
{
	if(Num<MaxNum)
	{
	    if(_LogInLocation==3)
	    {
	       document.cookie = "OpenNewShow=1;domain="+CookieDomain+";path=/";
	       window.location.href=PARENT_URL+'ForumLoginRefreshPage.asp';
	    }
	    else
	    {
		    window.location.href="/OpenProgram.asp";
		}
	}
	else
	{
		blogtvAlert('User is limited to 1 show');
	}
}

function CheckContactMail()
{
    YourName=$g("YourName").value;
    YourEmail=$g("YourEmail").value;
    Subject=$g("Subject").value;
    ContactMsg=$g("ContactMsg").value;
    
    YourName=YourName.trim();
    YourEmail=YourEmail.trim();
    Subject=Subject.trim();
    ContactMsg=ContactMsg.trim();
    
    if(YourName=="")
    {
        blogtvAlert("Enter your name");
        return false;        
    }
    if(YourEmail=="")
    {
        blogtvAlert("Please enter your E-mail address");
        return false;        
    }
    if(CheckEmails(YourEmail))
    {  
        blogtvAlert("Invalid E-mail ");
        return false;        
    } 	
    if(Subject=="")
    {
        blogtvAlert("Please select a subject");
        return false;        
    }
	if(ContactMsg=="")
	{
        blogtvAlert("Please enter message");
        return false;        
	}	
	
	if(($g("Subject").value==17))
	{   
        $g("remote").value = REMOTE_ADDR;
        $g("agent").value = USER_AGENT;
        $g("accept").value = HTTP_ACCEPT;
        $g("browser").value = USER_BROWSER;
        $g("os").value = OS;
        $g("screen").value = SCREEN_INF;
        $g("engine").value = SCRIPT_ENG;
        $g("cookie").value = COOKIE_ENL;
        $g("java").value = JAVA_ENL;
        $g("msxml").value = MSXML_ENL;
        $g("xmlhttp").value = XMLHTTP_ENL;
        $g("brolang").value = BROWSER_LANG;
        $g("sys").value = SYS_LANG;
        $g("flashv").value = FLASH_VERSION;     
        $g("p6667").value = PORT_6667;
        $g("p48365").value = PORT_48365;
        $g("p1935").value = PORT_1935;	
    }
         	
	document.Contact.submit();
}

function CheckInviteFriens(f)
{
    if($g("YourName").value=="")
    {
        blogtvAlert("ENTER YOUR NAME");
        $g("YourName").focus();
        return false;        
    }
    
	if($g("YourMsg").value=="")
	{
        blogtvAlert("Please enter message");
        $g("YourMsg").focus();
        return false;        
	}
	EmailStr = new String($g("FEmails").value);
	if(EmailStr=="")
	{
        blogtvAlert("Please fill friends emails");
        $g("FEmails").focus();
        return false;        
	}
	
	if(EmailStr.indexOf(",")>0)
	{
	    EmailArr = EmailStr.split(",");	
	    for(E=0;E<=EmailArr.length;E++)
	    {
	        TheEmail = new String(removeAllSpaces(EmailArr[E]));
	        if((TheEmail != "") && (TheEmail!="undefined"))
	        {	            
	             if(!isEmail(TheEmail))
	             {
	                blogtvAlert("Please fill valid emails");
	                $g("FEmails").focus();
	                return false;
	             }
	        }
	    }
	}
	else
	{
	   if(!isEmail(EmailStr))
       {
            blogtvAlert("Please fill valid emails");
            $g("FEmails").focus();
            return false;
       } 
	}
	f.submit();
}


function PopUpLinks(url)    
{
    try{
        if ((window.opener)&&(!window.opener.closed))
        {   
            window.opener.location.href = url;
            window.opener.focus();
        }
       }
    catch(err)
       {   
            var win = window.open(url,'');
            win.focus();
       }
}

function cutText(obj,str,maxLength)
{   
    if(ff)
    {
        if (str.length > maxLength)
            {      
                str = obj.value + str;              
                obj.value = str.substring(0,maxLength);
                return false;
            }   
        else
            return true;    
    }
    else
    {
        if ((str.length > maxLength)||((obj.value.length+str.length)>maxLength))
            {      
                str = obj.value + str;              
                obj.value = str.substring(0,maxLength);
                return false;
            }   
        else
            return true;
    }            
}

function changeTimeZone(TimeZoneId)
{             
TimezoneObj = $g("TimeZone") ; 
if(TimezoneObj)
{            
    for(TZ=0;TZ<TimezoneObj.options.length;TZ++)
    {
        if(TimezoneObj.options[TZ].value==TimeZoneId)
        {
            TimezoneObj.options[TZ].selected = true;
        }
    }
}
}

function changeRegion(CountryId)
{
    xmlPage = "/Ajax/SignIn_GetRegion.asp?CountryId="+CountryId;
    RegionObjXml = CreateObjXML();
    RegionObjXml.open("GET", xmlPage ,true); 
    RegionObjXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    RegionObjXml.onreadystatechange = batchRegionChange;
    RegionObjXml.send(null); 
}

  function batchRegionChange()
  {
    if (RegionObjXml && RegionObjXml.readyState==4)
        {
        if (RegionObjXml.responseXML)
            {
                var RegionObj = RegionObjXml.responseXML.getElementsByTagName("Region");                        
                    
                    $g("Region").options.length = 0;
                    $g("Region").options[0] = new Option("--------",0);
                    
                if(RegionObj.length>0)
                {
                    
                    for(R=0;R<RegionObj.length;R++)
                    {                                
                        RegId = RegionObj[R].attributes.getNamedItem("Id").value;
                        RegName = RegionObj[R].attributes.getNamedItem("Name").value;                                
                        $g("Region").options[R+1] = new Option(RegName,RegId);
                    }                        
                    HadRegionValue = 1;                        
                    $g("Region").disabled = false;
                }
                else
                {  
                   HadRegionValue = 0;                       
                   $g("Region").disabled = true;
                }
                if($g("HadRegion"))
                {
                    $g("HadRegion").value = HadRegionValue;
                }
            }   
        }
    }

function copy_clip(meintext)
{
    if (window.clipboardData) 
    {
       // the IE-manier
            window.clipboardData.setData("Text", meintext);
       // waarschijnlijk niet de beste manier om Moz/NS te detecteren;
       // het is mij echter onbekend vanaf welke versie dit precies werkt:
    }
    else if (window.netscape) 
    { 
       // dit is belangrijk maar staat nergens duidelijk vermeld:
       // you have to sign the code to enable this, or see notes below 
       netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
       
       // maak een interface naar het clipboard
       var clip = Components.classes['@mozilla.org/widget/clipboard;1']
                     .createInstance(Components.interfaces.nsIClipboard);
       if (!clip) return;
       
       // maak een transferable
       var trans = Components.classes['@mozilla.org/widget/transferable;1']
                      .createInstance(Components.interfaces.nsITransferable);
       if (!trans) return;
       
       // specificeer wat voor soort data we op willen halen; text in dit geval
       trans.addDataFlavor('text/unicode');
       
       // om de data uit de transferable te halen hebben we 2 nieuwe objecten 
       // nodig om het in op te slaan
       var str = new Object();
       var len = new Object();
       
       var str = Components.classes["@mozilla.org/supports-string;1"]
                    .createInstance(Components.interfaces.nsISupportsString);
       
       var copytext=meintext;
       
       str.data=copytext;
       
       trans.setTransferData("text/unicode",str,copytext.length*2);
       
       var clipid=Components.interfaces.nsIClipboard;
       
       if (!clip) return false;
       
       clip.setData(trans,null,clipid.kGlobalClipboard);
       
       }
       alert("Your code was copied to your clipboard\n\n");
       return false;
}

function SetPageRefreshTime(PageRefreshTime)
    {    
     var refreshTimer = 1000 * 60 * PageRefreshTime;
     setTimeout("window.location.reload();",refreshTimer);
    }

var TO;     
function clickTopButton(btnNum){
    // -1 hide the div
    var tmpSrc;
    var ar= new Array();
    ar[0]=new Array("divRecordedSubLinks","imgArrowdivTB3");
    ar[1]=new Array("divChannelsSubLinks","imgArrowdivTB4");
    clearTimeout(TO);
    if(btnNum==-1){
        for(btnNum=0;btnNum<2;btnNum++){
            $g(ar[btnNum][0]).style.display="none";
            tmpClass=$g(ar[btnNum][1]).className;
            if(tmpClass=="TopButtonArrowUpImg")
                $g(ar[btnNum][1]).className="TopButtonArrowDownImg";
            if(tmpClass=="TopPButtonArrowUpImg")
                $g(ar[btnNum][1]).className="TopPButtonArrowDownImg";
        }
    }else{
        $g(ar[btnNum][0]).style.display="block";
        tmpClass=$g(ar[btnNum][1]).className;
        if(tmpClass.indexOf("TopButtonArrow")>-1)
            $g(ar[btnNum][1]).className="TopButtonArrowUpImg";
        else
            $g(ar[btnNum][1]).className="TopPButtonArrowUpImg";
        TO=setTimeout("clickTopButton(-1)",3000);
        $g(ar[1-btnNum][0]).style.display="none";
        tmpClass=$g(ar[1-btnNum][1]).className;
        if(tmpClass.indexOf("TopButtonArrow")>-1)
            $g(ar[1-btnNum][1]).className="TopButtonArrowDownImg";
        else
            $g(ar[1-btnNum][1]).className="TopPButtonArrowDownImg";
    }
}

function changeToSignInPanel(){
    $g("myPanelHello").style.display="none";
    $g("myPanelLogin").style.display="block";

}
function setSubscribe()
{   
    aInnerHtml = GetDivInnerHTML(0);
    _ShowInnerDiv = false;
    _onDivCloseRefresh = false;    
    createCustomAlert("",aInnerHtml,"","","#D7D7D7","#FFFFFF");
    
}


function setSignIn()
{   
    aInnerHtml = GetDivInnerHTML(15);    
    _StartDiv= 6;
    _ShowInnerDiv = false;
    _onDivCloseRefresh = false;    
    createCustomAlert("",aInnerHtml,"770","460","#D7D7D7","#FFFFFF");
    sendReg();    
}

// ------ SCHEDULE FUNCTIONS ----------
function setMySchedule(TUserId){

  if (TUserId!=0){
     if(myShowsAr.length!=0){
            createCustomAlert("Schedule a LIVE show",GetDivInnerHTML(7),"605","405","","");
            show_calendar("Schedule_Date", "","divCal");  
            goToScheduleStep(0);    
        }else{
            return;
            _onDivCloseRefresh=true;
            createCustomAlert("Schedule a LIVE show",GetDivInnerHTML(8),"605","405","","");
            CreateShow(0);
        } 
     }else{         
         aInnerHtml=GetDivInnerHTML(6);
         _onDivCloseRefresh=true;
	     createCustomAlert("SIGN IN",aInnerHtml,"605","405","","");	
     }
}

var mySchedProgId;
var Sceduale_Date;
var clipBoardStr="";
function checkSchedule(){
    if(removeSpaces($g("ScheduleTitle").value) == '')
    {
        blogtvAlert("Please enter a title!");
    	return false;
    }
    if(($g("Schedule_Date").value == ''))  
    {
        blogtvAlert("Invalid date!");
    	return false;            
    }     
        
    var TheDayStr;
    ControlXmlPage = "/Ajax/Control_ExecuteSchedule.asp";
   
    var StrTitle = escape($g("ScheduleTitle").value);
    
    var dtStr= $g("Schedule_Date").value;   
    var objDt = new Date();
        objDt.setFullYear(dtStr.split("/")[2],dtStr.split("/")[1]-1,dtStr.split("/")[0]);
    var objProgram=$g("scheduleShow");
    var objSchedule_Hour=$g("Schedule_Hour");
    var objSchedule_Minute=$g("Schedule_Minute");      
    var objCycle=$g("Cycle");
    mySchedProgName=objProgram[objProgram.selectedIndex].text;
    mySchedProgId=objProgram[objProgram.selectedIndex].value;
    var embedStr ='<embed width="240" height="120" src="'+IIS_SERVER_LINK+'sch/'+mySchedProgId+'" type="application/x-shockwave-flash" bgcolor="#EDEDED" allowFullScreen="true"></embed>';
    $g("ClockDiv").innerHTML=embedStr;
    $g("txtClockEmbed").value=embedStr;
    clipBoardStr=embedStr;
    d = objDt.getDate();
    m = objDt.getMonth()+1;
    y = objDt.getFullYear();
    h = objSchedule_Hour[objSchedule_Hour.selectedIndex].value;  
    mi = objSchedule_Minute[objSchedule_Minute.selectedIndex].value;
    SDate = m + "/" + d + "/" + y;
    STime = h + ":" + mi; 
    $g("scheduleSendTo").innerHTML='<a href="mailto:?subject=Invitation to my LIVE blogTV show&body=Hi! Check out my new blogTV show. I will be broadcasting it LIVE in ' + SDate +' so come watch me! %0DThis is a link to my show page. Click it if you want to be reminded before it starts. %0D '+ IIS_SERVER_LINK+'shows/'+mySchedProgId+'">use your client on your computer</a>';        
    Sceduale_Date = objDt;
    
    //ToDate//
    Today = new Date();
    Todays_Year = Today.getFullYear();
    Todays_Month = Today.getMonth(); 
    Todays_Day = Today.getDate();  
    Today = (new Date(Todays_Year, Todays_Month, Todays_Day));       
    //Max date//
    Max_Date = (new Date(Todays_Year, Todays_Month, Today.getDate() + 30));            
    SProgram=objProgram[objProgram.selectedIndex].value;  
    SRemindAlert = ($g("CBRemindAlert").checked)? 1:0;
    SCycle = objCycle[objCycle.selectedIndex].value;
    
    TheDayStr = "";
    if(SCycle==2)
    {
       TheDayStr = (objDt.getDay()+1)+",";     
    }
    parm = "ProgramId="+SProgram+"&STitle="+StrTitle+"&SDate="+SDate+"&STime="+STime+"&Cycle="+SCycle+"&Days="+TheDayStr+"&RemindAlert="+SRemindAlert;
    Sparm ="DDate="+d+ "&MDate="+m+ "&YDate="+y+ "&STime=" + STime;
    objSchduleXML = CreateObjXML();
    objSchduleXML.open("POST", "/Ajax/Control_CheckScheduleDate.asp" ,false); 
    objSchduleXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objSchduleXML.send(Sparm);
    if (objSchduleXML.responseXML)
    {   var Str = objSchduleXML.responseXML.getElementsByTagName("Str"); 
        SFlag = parseInt(Str[0].firstChild.data);		                        
        if (SFlag == 2)
        {   blogtvAlert("Oops, the date you selected already passed!");
            return false;                 
        }
        if (SFlag == 3)
        {   blogtvAlert("Schedule is limited to 30 days");
            return false;                 
        }     
        if (SFlag == 4)
        {   blogtvAlert("Invalid date");
            return false;                 
        }                           
     }
     
    setObjXML();
    objXML.open("POST", ControlXmlPage ,true); 
    objXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objXML.send(parm); 
    return true;
 }
 function copyInputStr(divName){
  $g(divName).focus();
  $g(divName).select();
  copy_clip(clipBoardStr);
 }
 function twiterTogoToScheduleStep(ActionBtn)
 {
    if(ActionBtn==1){
        mySchedProgId = 0;
    }
    goToScheduleStep(4);
 }
 
 
 function goToScheduleStep(SN){
    //0-init 1-invite freinds 2-finish 3-Send Email 4-Send Twitter 5- waiting for twitter finish
    s=4;       
    switch(SN){
        case 0: 
            s=1;break;
        case 1:
            if (!checkSchedule()) return;
            $g("divScheduleStep2").style.display="block"; 
            s=2;break;
        case 2:
            if (!checkSchedule()) return;
            break;
        case 3: 
            if(!CheckSprade(mySchedProgId)) return; 
            blogtvAlert("The e-mail has been sent");
            $g("YourMailMsg").value="";
            $g("FEmails").value="";   
            break;
        case 4:            
            CheckTwitter(mySchedProgId);
            return;  
            break;
        case 6:
            s=2;break;
        case 7:             
            _scheduleDiv = true;
            s=3;
            getTwitterDetails();
            break;
    }
    for(var i=1;i<5;i++)
         $g("divScheduleStep"+i).style.display="none";
    $g("divScheduleStep"+s).style.display="block";
 }
 
function CheckSprade(ShowId)
{
    SenderMsg = $g("YourMailMsg").value; 
    EmailStr = new String(removeAllSpaces($g("FEmails").value));
      
       
	if(SenderMsg=="")
	{
        blogtvAlert("Please enter message");
        $g("YourMailMsg").focus();
        return false;        
	}
	
	if(EmailStr=="")
	{
        blogtvAlert("Please fill friends emails");
        $g("FEmails").focus();
        return false;        
	}
	
	if(EmailStr.indexOf(",")>0)
	{
	    EmailArr = EmailStr.split(",");	
	    for(E=0;E<=EmailArr.length;E++)
	    {
	        TheEmail = new String(removeAllSpaces(EmailArr[E]));
	        if((TheEmail != "") && (TheEmail!="undefined"))
	        {	            
	             if(!isEmail(TheEmail))
	             {
	                blogtvAlert("Please fill valid emails");
	                $g("FEmails").focus();
	                return false;
	             }
	        }
	    }
	}
	else
	{
	   if(!isEmail(EmailStr))
       {
            blogtvAlert("Please fill valid emails");
            $g("FEmails").focus();
            return false;
       } 
	}
		
	xmlPage = "/Ajax/Email_SpradeTheword.asp";
    parm = "YourName="+CookieUserName+"&ShowId="+ShowId+"&YourMsg="+ encodeURI(SenderMsg)+"&FEmails="+ encodeURI(EmailStr);
    RegionObjXml = CreateObjXML();
    RegionObjXml.open("POST", xmlPage ,false); 
    RegionObjXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    RegionObjXml.send(parm); 
    return true;
       
}

function writeButton(ButtonText,posTop,posLeft,ClickAct,InnerImgClass,TextClass)
{
        Str= '<div style="position:absolute;top:'+posTop+'px;left:'+posLeft+'px;cursor:pointer;" onclick="'+ClickAct+'">'+
                '<div class="subscribeLeftImg"></div>'+
                '<div class="subscribeImgBg"><div class="'+TextClass+'">'+ButtonText+'</div></div>'+
                '<div class="'+InnerImgClass+'"></div>'+
                '<div class="subscribeRightImg"></div>'+
             '</div>';
             
        return Str;
}

function createCustomAlert(divTitle,aInnerHtml,aWidth,aHeight,aBorderColor,aBgColor) 
{
    //clears the page refresh 
    if (_setPageRefresh)
        clearInterval(_winInterval); 
	// shortcut reference to the document object
	d = document;
    // if resize div keep the _onDivCloseRefresh into temp var
    var _temponDivCloseRefresh = _onDivCloseRefresh; 
    _onDivCloseRefresh = false;
    // if the modalContainer object already exists in the DOM, bail out.
	//if(d.getElementById("modalContainer")) return;
	if(d.getElementById("modalContainer")) removeCustomAlert();
	_onDivCloseRefresh = _temponDivCloseRefresh; 	
	// create the modalContainer div as a child of the BODY element
	fObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
	fObj.id = "modalContainerOpacity";
	 // make sure its as tall as it needs to be to overlay all the content on the page
	//fObj.style.height = document.documentElement.scrollHeight + "px";
    fObj.style.height = d.body.scrollHeight + "px";
    
	// create the modalContainer div as a child of the BODY element
	mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
	mObj.id = "modalContainer";
	 // make sure its as tall as it needs to be to overlay all the content on the page
	//mObj.style.height = document.documentElement.scrollHeight + "px";
	mObj.style.height = d.body.scrollHeight + "px";
    
	// create the DIV that will be the alert 
	alertObj = mObj.appendChild(d.createElement("div"));
	alertObj.id = "alertBox";
	// MSIE doesnt treat position:fixed correctly, so this compensates for positioning the alert
	//if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
	if(_AIMPlayer==1)
	{
	    if(d.all && !window.opera) alertObj.style.top = (d.body.scrollTop-40) + "px";
	}
	else
	{	    
	    if(d.all && !window.opera) alertObj.style.top = d.body.scrollTop + "px";
	}
	// center the alert box   
    aWidth=(aWidth=="")? 605: aWidth;
    aHeight=(aHeight=="")? 405: aHeight;
   	
        
    if (isIEbrowser())
        alertObj.style.top = (((document.body.scrollTop + document.body.clientHeight/2) - (aHeight/2)) - 45) + "px";
    else
        alertObj.style.top = (((document.body.clientHeight - (aHeight))/2) - 45) + "px";
	
	
	alertObj.style.left = (d.body.scrollWidth - aWidth)/2 + "px";    
    var Sel = d.getElementsByTagName("select");
    for(i=0;i<Sel.length;i++)
    {
        Sel[i].disabled=true;
    }    
    BasicAlertStr='<iframe id="iframeBox" style="position:absolute;display:none;" frameborder=0 scrolling=no marginwidth=0 src="" marginheight=0></iframe>'+
    '<div id="divAlertBorder" style="position:absolute;display:none;">' + 
        '<div id="divAlertBox">'+            
            '<div id="divAlertTitleBg">'+
                '<div class="leftDarkGrayStrip posAbs " style="left:-1px;"></div>'+
                '<div class="rightDarkGrayStrip posAbs" style="right:-3px;"></div>'+
                '<div id="divAlertTitle" class="C_W"></div>'+
                '<div id="divAlertTitleClose"  class="C_W" onclick="removeCustomAlert();">Close</div>'+
                '<div id="divAlertTitleCloseImg" class="xIcon" onclick="removeCustomAlert();"></div>'+
            '</div>'+
            '<div id="divAlertContent"></div>'+           
        '</div>'+    
    '</div>';
    
   $g("alertBox").innerHTML=BasicAlertStr;   
   var objBorder=$g("divAlertBorder");
   var objBox=$g("divAlertBox");
   var objTitleBg=$g("divAlertTitleBg");
   var objTitle=$g("divAlertTitle");  
   var objContent=$g("divAlertContent");  
   var objIframe=$g("iframeBox");   
   if(objBorder){
        with(objBorder.style){            
            display="block";
            width=(aWidth=="")? 605: aWidth;
            height=(aHeight=="")? 405: aHeight;
            backgroundColor=(aBorderColor=="")?"#515151":aBorderColor;
        }
        
   }
   if(objBox){
        with(objBox.style){                        
            width=aWidth-10;
            height=aHeight-10;
            backgroundColor=(aBgColor=="")?"#EDEDED":aBgColor;
        }
   }
   if(objIframe){
        with(objIframe.style){
            width=aWidth;
            height=aHeight;
            display="block";
            backgroundColor="Black";
        }  
   }
   if(objTitleBg){
        objTitleBg.style.width=aWidth-22; 
        if(!_ShowInnerDiv){
            objTitleBg.style.display = "none";
            objContent.style.top = "0px";
            objContent.style.left = "0px";
        }   
   }
   if(objTitle){
        objTitle.innerHTML=divTitle;
   }   
   if(objContent){
        objContent.innerHTML=aInnerHtml;      
   }
   _ShowInnerDiv = true;
}

// removes the custom alert from the DOM;
function removeCustomAlert() 
{	
    _onDivCloseRefresh= false;
	// Close color Picker  
	color_picker_div = false;
	if($g("modalContainer") != null)
	{
	    document.getElementsByTagName("body")[0].removeChild($g("modalContainer"));	
	}    
	if($g("modalContainerOpacity") != null)
	{
	    document.getElementsByTagName("body")[0].removeChild($g("modalContainerOpacity"));
	}  
	
    var Sel = document.getElementsByTagName("select");
    for(i=0;i<Sel.length;i++)
    {
        Sel[i].disabled=false;
    }
    // set the page refresh
    if (_setPageRefresh){
        _winInterval=setInterval('location.reload(true)',300000);	
    }    
    if (_onDivCloseRefresh){
        location.reload(true);         
    }
}

/////////////////////////////////////////////////////////////////////////
/////////////////////////////////// TWITTER /////////////////////////////
/////////////////////////////////////////////////////////////////////////

function SetTwitterMsg()
{
    var _UserPageUrl = _IIS_SERVER_LINK + "people/" +  _PlayerName;
    var _TwitterMsg = "I'm broadcasting on @blogTV.com now, come see me! " + _UserPageUrl;    
    if(!_isPageOwner){
        _TwitterMsg = "I'm watching ^^broadcaster^^'s show on @blogTV.com, come check it out with me! " + _UserPageUrl;
        _TwitterMsg = _TwitterMsg.replace(/\^\^broadcaster\^\^/ig, _PlayerName);   
    }
    if(_scheduleDiv){
        hr = STime.split(":")[0];
        mi = STime.split(":")[1];
        if(hr.length<=1){
            hr = "0" +hr;
        }
        if(mi=="0"){
            mi = "00";}
        STime = hr + ":" + mi ;
        var _TwitterMsg = "I'll be broadcasting at ^^SDate^^ ^^STime^^ on @blogTV.com. Be there or be square! " + _UserPageUrl;            
            _TwitterMsg = _TwitterMsg.replace(/\^\^SDate\^\^/ig, SDate);  
            _TwitterMsg = _TwitterMsg.replace(/\^\^STime\^\^/ig, STime);              
    }
    return _TwitterMsg;
}

function CheckTwitterDetailsBox()
{
    if(!$g("saveTwitterDetails").checked){             
        $g("onStartBroadcast").checked = false;
    }
}
function CheckStartBroadcastBox()
{
    if($g("onStartBroadcast").checked){
        $g("saveTwitterDetails").checked = true;
    }
}



var _TwitterStatus=0;
var _TwitterChat = false; 
var _TwitterChatUserPsw = ""; 
var _TwitterChatUserName = ""; 
var _TwitterOwnerWarningMsg = true;
function CheckTwitterChat()
{
    SenderName = $g("TwitterChatUserName").value;
    SenderPassword = $g("TwitterChatUserPsw").value;    
    SenderMsg = "I am on blogTV.com now. "+IIS_SERVER_LINK+"people/"+CookieUserName;
    
    _TwitterChatUserName = SenderName;
    _TwitterChatUserPsw = SenderPassword;
    tSaveDetails = 0;
    onStartBroadcastPage = 0;
    _followUsOnTwitter = 0;
    BtnAction = 2;    
    if($g("saveTwitterDetails") != null)
    {
        if($g("saveTwitterDetails").checked == true)
        {
            tSaveDetails = 1;
        }
    }  
    
    if($g("onStartBroadcast") != null)
    {
        if($g("onStartBroadcast").checked == true)
        {
            onStartBroadcastPage = 1;
        }
    } 
    
    if($g("followUsOnTwitter") != null)
    {
        if($g("followUsOnTwitter").checked == true)
        {
            _followUsOnTwitter = 1;
        }
    }
    
    if(removeAllSpaces(SenderName)=="")
    {
        writeErrorMessage("TwitterChatErrorDiv","Please fill all the fields in the form");
        $g("TwitterChatUserName").focus();
        return false;        
    }
    
    if(removeAllSpaces(SenderPassword)=="")
	{
        writeErrorMessage("TwitterChatErrorDiv","Please fill all the fields in the form");
        $g("TwitterChatUserPsw").focus();        
        return false;
    }
	
	if (_isPageOwner && _TwitterOwnerWarningMsg){
        $g("tWarningDiv").style.display="block";
        $g("tLogIn").style.display="none";
        $g("tcheckboxs").style.display="none";
        
        _TwitterOwnerWarningMsg = false;
        return;
    }
    _TwitterOwnerWarningMsg = true;
    $g("tWarningDiv").style.display="none";
	$g("divSending").style.display="block";
	$g("tLogIn").style.display="none";	   
	$g("tcheckboxs").style.display="none";
	$g("tbuttons").style.display="none";
	_TwitterStatus=0;
	clearErrorMessage("TwitterChatErrorDiv");
					
	TwitterAjax(SenderName, SenderMsg, SenderPassword, tSaveDetails, onStartBroadcastPage, BtnAction ,_followUsOnTwitter)
    
}


function CheckTwitter(BtnAction)
{   //BtnAction: 0-update & save; 1-save    
    tSenderName = $g("twitterMsgYourName").value;     
    SenderMsg = $g("YourMsg").value;        
    SenderPassword = $g("twitterUserPsw").value;    
    tSaveDetails = 0;
    onStartBroadcastPage = 0;
    _followUsOnTwitter = 0;
    
    if($g("saveTwitterDetails") != null)
    {
        if($g("saveTwitterDetails").checked == true)
        {
            tSaveDetails = 1;
        }
    }  
    
    if($g("onStartBroadcast") != null)
    {
        if($g("onStartBroadcast").checked == true)
        {
            onStartBroadcastPage = 1;
        }
    } 
    
    if($g("followUsOnTwitter") != null)
    {
        if($g("followUsOnTwitter").checked == true)
        {
            _followUsOnTwitter = 1;
        }
    }
    
    if(SenderMsg.length>140){
        writeErrorMessage("twitterErrorDiv","Message is limited to 140 characters.");
        return false; 
    }
    
    if(removeAllSpaces(tSenderName)=="" || tSenderName.toLowerCase()=="Enter Username".toLowerCase())
    {
        writeErrorMessage("twitterErrorDiv","Please fill all the fields in the form");
        $g("twitterMsgYourName").focus();
        return false;        
    }
    
	if(removeAllSpaces(SenderPassword)=="" || SenderPassword.toLowerCase()=="Enter Password".toLowerCase())
	{
        writeErrorMessage("twitterErrorDiv","Please fill all the fields in the form");
        if($g("twitterUserPsw")){        
            $g("twitterUserPsw").focus();
        }
        return false;        
	}
	
	if(removeAllSpaces(SenderMsg)=="")
	{
        writeErrorMessage("twitterErrorDiv","Please fill all the fields in the form");
        $g("YourMsg").focus();
        return false;        
	}
	
	_TwitterStatus=0;
	clearErrorMessage("twitterErrorDiv");				
	
	TwitterAjax(tSenderName, SenderMsg, SenderPassword, tSaveDetails, onStartBroadcastPage, BtnAction ,_followUsOnTwitter)
    setSendingImg();
    return true;
    
}

function TwitterAjax(tSenderName, SenderMsg, SenderPassword, tSaveDetails, onStartBroadcastPage, BtnAction ,_followUsOnTwitter){
    
    xmlPage = "/Ajax/API_AddToSite.asp";
    parm = "SiteId=1&userName="+ escape(tSenderName)+"&message="+ escape(SenderMsg)+"&password="+ encodeURI(SenderPassword.replace(/&/g,"^"))+"&saveDetails="+ tSaveDetails + "&onStartBroadcast="+ onStartBroadcastPage+"&BtnAction="+BtnAction+"&followUsOnTwitter="+_followUsOnTwitter;
    TwitterObjXml = CreateObjXML();
    TwitterObjXml.open("POST", xmlPage ,true); 
    TwitterObjXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    if(BtnAction!=2){
        TwitterObjXml.onreadystatechange=AnswerTwitterAjax;
    }else{
        TwitterObjXml.onreadystatechange=AnswerTwitterChatAjax;
    }    
    TwitterObjXml.send(parm); 
}

function AnswerTwitterAjax()
{
     if (TwitterObjXml && TwitterObjXml.readyState==4)
	 {
        if (TwitterObjXml.responseXML)
	    {   
	        var SiteIdObj = TwitterObjXml.responseXML.getElementsByTagName("SiteId");                
                _SiteId = parseInt(SiteIdObj[0].firstChild.data); 
            
            var SuccessObj = TwitterObjXml.responseXML.getElementsByTagName("Success");                
                _Success = parseInt(SuccessObj[0].firstChild.data);
            
            var MsgObj = TwitterObjXml.responseXML.getElementsByTagName("Msg");                
                _Msg = MsgObj[0].firstChild.data;
            
            _TwitterStatus++;
             if (_Success == 0){
                if($g("twitterMsgYourName")){
                    _SenderName = $g("twitterYourName").value;                
                }
                if($g("YourMsg")){
                    _SenderMsg = $g("YourMsg").value;                
                }
                if($g("twitterUserPsw")){
                    _SenderPassword = $g("twitterUserPsw").value;                
                }
                _TwitterChatUserPsw = "";
                _TwitterChatUserName = "";
             }else{                
                _TwitterStatus++;
             }      
             if(_Msg!='')
             {  
                writeErrorMessage("twitterErrorDiv",_Msg);                 
             }
             
        }
    }
}

function AnswerTwitterChatAjax()
{
    if (TwitterObjXml && TwitterObjXml.readyState==4)
	{
        if (TwitterObjXml.responseXML)
	    {
	        $g("divSending").style.display="none";
	        $g("tLogIn").style.display="block";
	        $g("tcheckboxs").style.display="block";
	        $g("tbuttons").style.display="block";
	        
		    var SiteIdObj = TwitterObjXml.responseXML.getElementsByTagName("SiteId");                
                _SiteId = parseInt(SiteIdObj[0].firstChild.data); 
            
            var SuccessObj = TwitterObjXml.responseXML.getElementsByTagName("Success");                
                _Success = parseInt(SuccessObj[0].firstChild.data);
            
            var MsgObj = TwitterObjXml.responseXML.getElementsByTagName("Msg");                
                _Msg = MsgObj[0].firstChild.data;
            
            _TwitterStatus++;
            
             if (_Success == 0){
                _SenderName = $g("TwitterChatUserName").value;                                
                _SenderPassword = $g("TwitterChatUserPsw").value;  
                _TwitterChatUserPsw = "";
                _TwitterChatUserName = "";
             }else{                
                _TwitterStatus++;
             }      
             if(_Msg!='')
             {    
                writeErrorMessage("TwitterChatErrorDiv",_Msg);  
                if (_Success == 1){
                    if(_isPageOwner){
                        _TwitterChatName = "@"+_TwitterChatUserName;   
                        if($g("twitterChatMsg")){
		                    $g("twitterChatMsg").value="Hi " + _TwitterChatName + " "; 
		                    $g("TwitterChatUserPsw").value= "";
		                }
                    }
                    $g("TwitterUserName").innerHTML = "@"+_TwitterChatUserName;
                    setTimeout("TwitterMenu(1);",1500);
                }                
            }
	    }
	}
}

function clearErrorMessage(divName){
 try{
    var obj=$g(divName);
    obj.style.display="none";
    obj.innerHTML="";
    }
    catch(err){};  
}
function setSendingImg(){
    try{ 
       var obj=$g("divSending");
       switch(_TwitterStatus){
            case 0: obj.style.display="block";
                    setTimeout('setSendingImg()',500);
                    break;
            case 1: obj.style.display="none";
                    break;
            case 2: obj.style.display="none";
                    $g("YourName").value="";
                    $g("UserPsw").value="";
                    $g("YourMsg").value="";
                    setTimeout('clearErrorMessage("twitterErrorDiv");',3000);              
        }
     
    }
    catch(err){};  
    
}
function writeErrorMessage(divName,messageText){
    var obj=$g(divName);
    changeClass(divName,"ErrMsg");
    obj.style.display="block";
    obj.innerHTML=messageText;
}
function changeClass(fieldId,newClassName){    
  var myField = $g(fieldId);
  myField.className = newClassName;
}
function writeGreenButtonJS(width,text,jsText)
{
Str = "" + 
"<div class='GreenMidBtn' style='width:" + width + "px;' Title='" + text + "' onclick='" + jsText + "'>" +
     "<div class='GreenRightBlackBtn' style='position:absolute;left:" + (width-3) + "px;'></div>" +
     "<div class='FB F12 LH13 CursorP C_W posAbs TxtC CCase' style='width:" + (width-6) + "px;left:3px; top:5px;' >" +
        text  +
    "</div>" +
    "<div class='GreenLeftBlackBtn posAbs' style='left:-1px'></div>" +
"</div>";
return(Str);
}

function writeBlackButtonJS(width,text,jsText)
{
Str = "" + 
"<div class='topSearchBox' style='width:" + width + "px;' Title='" + text + "' onclick='" + jsText + "'>" +
     "<div class='rightBlackButton' style='position:absolute;left:" + (width-3) + "px;'></div>" +
     "<div class='F12 LH13 CursorP C_W posAbs TxtC' style='width:" + (width-6) + "px;left:3px; top:5px;' >" +
        text  +
    "</div>" +
    "<div class='leftBlackButton posAbs' style='left:-1px'></div>" +
"</div>";
return(Str);
}
function ChangeNewsFeed(itemNum){
    var objAr=document.getElementsByName("divNewsFeed");
    if(objAr){
        itemNum=(itemNum<objAr.length)?(itemNum):0;
        for(var i=0;i<objAr.length;i++)
            objAr[i].style.display="none";
        objAr[itemNum].style.display="block";
        setTimeout('ChangeNewsFeed('+(itemNum+1)+')',5000);
    }
}
function ChangePimg(ShowId,iAct)
{
    $g('Pdesc'+ShowId).style.display=(iAct==1)? 'block':'none';
}
function ChangeUPimg(ShowId,iAct)
{
    $g('UPdesc'+ShowId).style.display=(iAct==1)?'block':'none';     
}
function writeSubScribeButton(ProgramId,MyProgramStatus,TuserId, posTop,posLeft,TUserName)
{
    if(MyProgramStatus==0) 
    {        
        Str= '<div style="position:absolute;top:'+posTop+'px;left:'+posLeft+'px;cursor:pointer;" onclick="SetMyProgram(this,'+ProgramId+','+MyProgramStatus+','+TuserId+','+TUserName+');">'+
                '<div class="subscribeLeftImg"></div>'+
                '<div class="subscribeImgBg"><div class="smallBlackLink">subscribe</div></div>'+
                '<div class="subscribeInnerImg"></div>'+
                '<div class="subscribeRightImg"></div>'+
             '</div>';
    }             
    else
    {    
        Str= '<div style="position:absolute;top:'+posTop+'px;left:'+posLeft+'px;cursor:pointer;" onclick="SetMyProgram(this,'+ProgramId+','+MyProgramStatus+','+TuserId+','+TUserName+');">'+
                '<div class="unSubscribeLeftImg"></div>'+
                '<div class="unSubscribeImgBg"><div class="smallGreenFont">unsubscribe</div></div>'+
                '<div class="unSubscribeInnerImg"></div>'+
                '<div class="unSubscribeRightImg"></div>'+
             '</div>';
    }      
    return Str;
}

function setCustomAlertInnerHTML(aInnerHtml){
    var objContent=$g("divAlertContent").innerHTML=aInnerHtml;
}
var _MobileSubscribe = 0;
function SetMyProgramHP(ProgramId, MyProgramStatus,TuserId)
{
    ChangeSubscribeDiv()        
    var BR=0;
    var SR=0;
    var RV=0;
    var ByM=0;
    var ByE=0;
    var ByT=0;
    var ByA=0;
    
    var StartRemind = $g("StartRemind");
    var RemindBef = $g("RemindBef");
    var RemindVod = $g("RemindVod");
    
    var ByMobile = $g("ByMobile");
    var ByEmail = $g("ByEmail");
    var ByToolbar = $g("ByToolbar");
    var ByAim = $g("ByAim");
    
    if(!_isSubscribe)
    {
        _isSubscribe = true;
        if(StartRemind.checked) SR=StartRemind.value;
        if(RemindBef.checked) BR=RemindBef.value;
        if(RemindVod.checked) RV=RemindVod.value;
        
        if(ByMobile.checked)  ByM=1;
        if(ByMobile.checked)  _MobileSubscribe=1;
        if(ByEmail.checked)   ByE=1;
        //if(ByToolbar.checked) ByT=1;
        //if(ByAim.checked)     ByA=1;
        
        bTV2N.LogAct("",ProgramId,219,"");
        url = "/Ajax/My_SetProgram.asp";
        str = "ProgramId="+ProgramId+"&Status="+MyProgramStatus+"&SR="+SR+"&BR="+BR+"&RV="+RV+"&ByM="+ByM+"&ByE="+ByE+"&ByT="+ByT+"&ByA="+ByA;
        objMyXML = CreateObjXML();
        objMyXML.open("POST", url ,true); 
        objMyXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
        objMyXML.onreadystatechange = batchMyChange;
        objMyXML.send(str);
    }        
}

function batchMyChange()
{
    if (objMyXML && objMyXML.readyState==4)
	{
        if (objMyXML.responseXML)
		{  
		    _isSubscribe = false;
            var Str = objMyXML.responseXML.getElementsByTagName("Str");
            Str = Str[0].firstChild.data;
            if(Str=='True')
            {
                var ShowId = objMyXML.responseXML.getElementsByTagName("ShowId");
                ShowId = ShowId[0].firstChild.data;
                //if(_ownerUserName=="undefined")
                //{
                    var _ownerUserName = objMyXML.responseXML.getElementsByTagName("OwnerUserName");
                    _ownerUserName = _ownerUserName[0].firstChild.data;               
                //}
                var ByMobile = objMyXML.responseXML.getElementsByTagName("ByMobile");
		            ByMobile = ByMobile[0].firstChild.data;
		        var MobileActive = objMyXML.responseXML.getElementsByTagName("MobileActive");
		            MobileActive = MobileActive[0].firstChild.data;
		        var MobileErr = objMyXML.responseXML.getElementsByTagName("MobileErr");
		            MobileErr = MobileErr[0].firstChild.data;
		        var ByEmail = objMyXML.responseXML.getElementsByTagName("ByEmail");
		            ByEmail = ByEmail[0].firstChild.data;     
		        var ByToolbar = objMyXML.responseXML.getElementsByTagName("ByToolbar");
		            ByToolbar = ByToolbar[0].firstChild.data;
		        var ToolbarErr = objMyXML.responseXML.getElementsByTagName("ToolbarErr");
		            ToolbarErr = ToolbarErr[0].firstChild.data;
		        var ByAim = objMyXML.responseXML.getElementsByTagName("ByAim");
		            ByAim = ByAim[0].firstChild.data;
		        var AimErr = objMyXML.responseXML.getElementsByTagName("AimErr");
		            AimErr = AimErr[0].firstChild.data;		        
		            
		        if(ByMobile==1 && MobileActive==0){
		            //aInnerHtml = SetInnerDivContent(2);		        
		            getSmsUserDetailsDiv()
		        } 
		        else
		        {
		            _SetOwnerUserName = _ownerUserName;
		            writeTnxSubDiv();		           
		        }
            }
		}	
    }		
}

isCreateButtonPressed=false;
function CreateShow(step){
     if (isCreateButtonPressed)
        return;
     Title=($g("ShowName"))?$g("ShowName").value:"";
     ShowTags=($g("ShowTags"))?$g("ShowTags").value:"";
     ChannelId=($g("PickChannel"))?$g("PickChannel").value:"";
     param="Title="+escape(Title)+"&ShowTags="+escape(ShowTags)+"&ChannelId="+ChannelId+"&step="+step;
     xmlPage = '/Ajax/Program_CreateShowDiv.asp';
     objRegXml = CreateObjXML();
     objRegXml.open('POST', xmlPage ,true);
     objRegXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
     objRegXml.onreadystatechange = batchCreateShowDiv;
     objRegXml.send(param);
     isCreateButtonPressed=true;
}
function batchCreateShowDiv()
{     if (objRegXml && objRegXml.readyState==4)
      {     if (objRegXml.responseXML)
            {  
               var Str = objRegXml.responseXML.getElementsByTagName("Str");
               Str = Str[0].firstChild.data;
               var Succeed= objRegXml.responseXML.getElementsByTagName("Succeed");
               Succeed=Succeed[0].firstChild.data;
               if (Succeed==1){
                    var ProgramId= objRegXml.responseXML.getElementsByTagName("ProgramId");
                    ProgramId=ProgramId[0].firstChild.data;
                    var ShowName= objRegXml.responseXML.getElementsByTagName("ShowName");
                    ShowName=ShowName[0].firstChild.data;
                    var JSTimeZone = objRegXml.responseXML.getElementsByTagName("JSTimeZone");                
                    jsUserTimeZone=JSTimeZone[0].firstChild.data; 
                    myShowsAr[0]=ProgramId;
                    myShowsAr[1]=ShowName;
                    setCustomAlertInnerHTML(GetDivInnerHTML(7));
                    show_calendar("Schedule_Date", "","divCal");  
                    goToScheduleStep(0);
                }else{
                    var divObj = $g("divCreateShow"); 
                    divObj.innerHTML = Str;
               }
               isCreateButtonPressed=false;                    
            }
      }
}
function sendReg(){
    JoinUsDiv()
    return;
     xmlPage = '/Ajax/SignIn_Div.asp';
     param= 'BackId=' + _StartDiv;
     objRegXml = CreateObjXML();
     objRegXml.open('POST', xmlPage ,true);
     objRegXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
     objRegXml.onreadystatechange = batchRegDiv;
     objRegXml.send(param);
}
function batchRegDiv()
{     if (objRegXml && objRegXml.readyState==4)
      {     if (objRegXml.responseXML)
            {  var Str = objRegXml.responseXML.getElementsByTagName("Str");
               Str = Str[0].firstChild.data;
               var divObj = $g("divRegistry"); 
               if(divObj){ 
                    divObj.innerHTML = Str;
               }  
               if (self.regScript) { // Already exists
                 return;
               }
               var head = document.getElementsByTagName("head")[0];
               script = document.createElement('script');
               script.id = 'regScript';
               script.type = 'text/javascript';
               script.src = IIS_SERVER_URL+"/include/signin.js";
               head.appendChild(script);
               script = document.createElement('script');
               script.id = 'PassStrength';
               script.type = 'text/javascript';
               script.src = IIS_SERVER_URL+"/include/PassStrength.js";
               head.appendChild(script);
                                    
            }
      }
}
function sendForgotPwd()    
{   
      objDivError=$g("divLoginErr");
      requestUserEmail = new String(removeSpaces($g("divAlertEmail").value)); 
    
      if(requestUserEmail==''){
            objDivError.innerHTML="Please enter your E-mail address";
            return false;
      }
      if (requestUserEmail.indexOf("--",0) >-1)
      {     objDivError.innerHTML="You entered invalid characters!";
           return false;
      }
      
      xmlPage = "/Ajax/Email_SendPsw.asp";
      parm = "SUserEmail=" + requestUserEmail;
      //parm = "SUserName="+requestUserName;
      objPswXml = CreateObjXML();
      objPswXml.open("POST", xmlPage ,true); 
      objPswXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
      objPswXml.onreadystatechange = batchSendForgotPwd;
      objPswXml.send(parm); 
      
}

function batchSendForgotPwd()
{     if (objPswXml && objPswXml.readyState==4)
      {     if (objPswXml.responseXML)
            {     var SendStatus = objPswXml.responseXML.getElementsByTagName("Status");
                  _SendStatus = SendStatus[0].firstChild.data;  
                  _Msg = "The e-mail you entered does not exist.";
                  if(_SendStatus==1)
                  {
                     _Msg = "The password has been sent";                     
                  }
                  $g("divLoginErr").innerHTML = _Msg;                   
            }
      }
}
var _StartDiv=0;

function GetDivInnerHTML(divNum){    
    var stWithTabs="";
    if(divNum==1||divNum==6)
       _StartDiv = divNum;
    var divTabs= '<div style="position:Relative;width:150px;height:19px;top:1px;left:-1px;z-index:+2">'+
                    '<div class="leftSmallWhiteTab posAbs" style="left:0px;"></div>'+
                    '<div class="posAbs BGW" style="left:5px;width:141px;height:19px;border-top:solid 1px #d7d7d7; text-align:center;font-weight:bold;">Using blogTV account</div>'+
                    '<div class="rightSmallWhiteTab posAbs" style="right:0px;"></div>'+
                '</div>'+
                '<div style="position:absolute;left:154;width:110px;height:19px;top:1px;cursor:pointer;" onclick="setCustomAlertInnerHTML(GetDivInnerHTML(5));">'+
                    '<div class="leftSmallWhiteDarkTab posAbs" style="left:0px;"></div>'+
                    '<div class="posAbs" style="left:5px;width:101px;height:19px;background-color:#C2C2C2;border-top:solid 1px #AFAFAF;text-align:center;font-weight:bold;">Using Email</div>'+
                    '<div class="rightSmallWhiteDarkTab posAbs" style="right:0px;"></div>'+
                '</div>';    
    
    switch (divNum){
        case 0: // subscribe div            
          return    divTabs = 
                    "<div class='posRel BGW BOGL' style='width:585px;height:250px;'>"+
	                   "<div style='position:absolute;left:5px;top:15px;'>"+
	                   "<input type='checkbox' id='StartRemind' name='StartRemind' value="+_SetMyProgId+" checked> Send a reminder when the show starts"+
	                   "</div>"+
	                   "<div style='position:absolute;left:5px;top:40px;'>"+
	                   "<input type='checkbox' id='RemindBef' name='RemindBef' value="+_SetMyProgId+"> Send a reminder 15 minutes before the show starts"+
	                   "</div>"+	
	                   "<div style='position:absolute;left:5px;top:65px;'>"+
	                   "<input type='checkbox' id='RemindVod' name='RemindVod' value="+_SetMyProgId+" checked> Send an alert when a new video was recorded"+
	                   "</div>"+	                   	               
	               "</div>"+
	               "<div class='posRel TxtC' style='top:20px;left:230px;width:130px;height:20px;'>"+
	               writeBlackButtonJS(120,"finish","SetMyProgramHP("+_SetMyProgId+","+_SetMyStatus+","+_SetMyUserId+");")+	           
	               "</div>";  
             
        case 1:  // 1-login / 6-without tabs          
                stWithTabs=divTabs;
        case 6:
            return stWithTabs+      
                   "<div class='posRel BGW BOGL' style='width:585px;height:250px;'>"+
                   "<div class='posAbs F12 FB LH14 txtC' style='top:10px;width:585px;'>You must be logged in to use this feature</div>"+
                   "<div class='posAbs F14 LH16' style='top:30px;width:585px;left:10px;'>Login to your blogTV account:</div>"+
                   "<div style='position:absolute;left:10px;top:65px;'>"+
                        "User name: <input type='Text' style='position:absolute;left:120px;' tabindex='10' name='divUserName' id='divUserName' onkeypress='return isEnglish(event) || isNumber(event) || isSigns(event,1,this.value);' alt='Enter Username' title='Enter Username' value='Enter Username' onfocus='claerMe(this);' autocomplete='on' class='Login'>"+
                   "</div>"+
                   "<div style='position:absolute;left:10px;top:90px;'>"+
                        "Password: <input type='Password' style='position:absolute;left:120px;' tabindex='11' name='divUserPsw' id='divUserPsw' onkeypress='CheckForEnterDiv(event,"+divNum+")' value='' alt='Enter Password' title='Enter Password' onfocus=ChangeBackPass('divUserPsw'); class='Logintxt' autocomplete='on'><a onclick='setCustomAlertInnerHTML(GetDivInnerHTML(2))' class='posAbs UnLine CursorP F9 LH10 C_GD' style='top:5px;left:230px;width:100px;' tabindex='3' title='Forgot your password?'>Forgot your password?</a>"+
                   "</div>"+
                    "<div class='posAbs' style='top:115px;left:130px;width:100px;height:20px;'>"+	
                        writeBlackButtonJS(100,"SIGN IN","Login("+divNum+");")+		           	               
                    "</div>"+
                    "<div id='divLoginErr' class='posAbs F12 FB LH14 txtC C_R' style='top:150px;width:585px;'></div>"+
                    "<div class='posAbs F16 LH17 FB C_GD' style='top:225px;left:10'>NEW USER?</div>"+
                    "<div class='posAbs' style='top:220px;left:230;width:100px;height:20px;'>"+writeBlackButtonJS(100,"SIGN UP HERE","setSignIn();")+"</div>"+
	            "</div>"+
	            "<div class='posRel BGW BOGL' style='left:245px;top:20px;width:100px;height:20px;'>"+
	                writeBlackButtonJS(100,"CLOSE","removeCustomAlert()")+
	            "</div>";
	    case 2:// forgot password
	      if (_StartDiv==6) divTabs="";
	      return divTabs +
	            "<div class='posRel BGW BOGL' style='width:585px;height:250px;'>"+
                   "<div class='posAbs F14 LH16 FB' style='top:10px;width:585px;left:10px;'>Forgot password?</div>"+
                   "<div style='position:absolute;left:10px;top:35px;'>"+
                        "Please enter the e-mail you gave during your registration. The username and password will be sent to your e-mail shortly:"+
                   "</div>"+
                   "<div style='position:absolute;left:10px;top:90px;'>"+
                       "<input type='text' style='position:absolute;width:300px;' tabindex='2' name='divAlertEmail' id='divAlertEmail' value=''  onkeypress='return isEnglishAndSigns4Emails(event) || isNumber(event)' class='Standard' autocomplete='on'>"+
                   "</div>"+
                    "<div class='posAbs' style='top:87px;left:320px;width:100px;height:20px;'>"+	
                        writeBlackButtonJS(100,"Send","sendForgotPwd()")+		           	               
                    "</div>"+
                    "<div id='divLoginErr' class='posAbs F12 FB LH14 txtC C_R' style='top:150px;width:585px;'></div>"+
                    "<div class='posAbs F16 LH17 FB C_GD' style='top:225px;left:10'>NEW USER?</div>"+
                    "<div class='posAbs' style='top:220px;left:120;width:100px;height:20px;'>"+writeBlackButtonJS(100,"SIGN UP HERE","setCustomAlertInnerHTML(GetDivInnerHTML(3));sendReg();")+"</div>"+
	            "</div>"+
	            "<div class='posRel BGW BOGL' style='left:245px;top:20px;width:100px;height:20px;'>"+
	                writeBlackButtonJS(100,"Back","setCustomAlertInnerHTML(GetDivInnerHTML("+_StartDiv+"))")+
	            "</div>";
	    case 3:// registration div
	        return "<div id='divRegistry' class='posRel BGW BOGL' style='width:585px; height:360px;'></div>";
	    case 4: //validate Email div
	    return "<div class='posRel' style='left:0px; top:0px; width:760px; height:375px;'>"+
                       "<div class='posAbs BGGR BOGLGR' style=' width:750px; height:20px; left:5px; top:5px;'>"+
                            "<div class='posRel C_W FB FH14 F14 UCase' style=' left:7px; top:3px;'>join us</div>"+
                            "<div id='divAlertTitleCloseImg' class='xDivIcon' onclick='removeCustomAlert();'></div>"+
                        "</div>"+                        
                        "<div class='posAbs BGGD2' style=' width:750px; height:20px; left:5px; top:30px;'>"+
                            "<div class='posRel C_W FH14 F14 CCase' style=' left:7px; top:4px;'>you are almost there</div>"+                            
                        "</div>"+
                        "<div class='posAbs' style=' width:750px; height:200px; left:5px; top:55px; border:solid 1px #E9E9E9'>"+
                            "<div class='posAbs' style='width:350px; top:15px; left:7px;'>"+
                                "An e-mail has been sent to you.<br>To complete the registration process please click on the link embedded in the e-mail or  copy and paste it into the address bar of your browser. <br><br>If  you did not  receive the e-mail <a onclick='Reactivate();' class='F13 LH15 UnLine FB CursorP' title='Send e-mail'>click here</a> and we will send it again. Thanks.<br>"+
                            "</div>" +
                            "<img src='"+ IMG_SERVER_URL +"box_icon.jpg' class='posAbs' style='width:137px; height:144px; top:15px; right:18px;' />"+
                            "<div class='posAbs F13 LH14 C_GD FB' id='divActivate' style='left:10px;top:130px;'></div>"+                            
                            "<div class='posAbs BGW BOGL' style='left:320px; top:140px; width:100px; height:20px;'>"+
	                           writeGreenButtonJS(100,"OK","removeCustomAlert();")+
	                       "</div>"+
                        "</div>"+
                    "</div>";
	      /* return "<div class='posRel BGW BOGL' style='width:585px;height:250px;'>"+
                   "<div class='posAbs F14 LH16 FB' style='top:10px;width:585px;left:10px;'>Welcome to blogTV</div>"+
                   "<div class='F13 LH14 C_GD' style='position:absolute;left:10px;top:35px;'>"+
                        "An e-mail has been sent to you.<br>To complete the registration process please click on the link embedded in the e-mail or  copy and paste it into the address bar of your browser. <br><br>If  you did not  receive the e-mail <a onclick='Reactivate()' class='F13 LH15 UnLine FB CursorP' title='Send e-mail'>click here</a> and we will send it again. Thanks.<br>"+
                   "</div>"+
                   "<div class='posAbs BGW BOGL' style='left:450px; top:140px; width:100px; height:20px;'>"+
	                   writeBlackButtonJS(100,"Start brodcasting","setCustomAlertInnerHTML(GetDivInnerHTML("+_StartDiv+"))")+
	               "</div>"+
	               "<div class='posAbs BGW BOGL' style='left:320px; top:140px; width:100px; height:20px;'>"+
	                   writeBlackButtonJS(100,"Invite Your friends","setCustomAlertInnerHTML(GetDivInnerHTML("+_StartDiv+"))")+
	               "</div>"+
                   "<div class='F13 LH14 C_GD FB' id='divActivate' style='position:absolute;left:10px;top:95px;'></div>"+
	            "</div>"+
	            "";
	           
	            "<div class='posRel BGW BOGL' style='left:245px;top:20px;width:100px;height:20px;'>"+
	                writeBlackButtonJS(100,"Next","setCustomAlertInnerHTML(GetDivInnerHTML("+_StartDiv+"))")+
	            "</div>";
	            */
	    case 5: //Using Email
	        var DivNum=(_SetMyUserId)?0:1;
	        var today = new Date();
	        return '<div style="position:Relative;width:150px;height:19px;top:1px;left:-1px;cursor:pointer;" onclick="setCustomAlertInnerHTML(GetDivInnerHTML('+DivNum+'));">'+
                        '<div class="leftSmallWhiteDarkTab posAbs" style="left:0px;"></div>'+
                        '<div class="posAbs" style="left:5px;width:141px;height:19px;background-color:#C2C2C2;border-top:solid 1px #AFAFAF; text-align:center;font-weight:bold;">Using blogTV account</div>'+
                        '<div class="rightSmallWhiteDarkTab posAbs" style="right:0px;"></div>'+
                    '</div>'+
                    '<div style="position:absolute;left:154;width:110px;height:19px;top:1px;z-index:+2" >'+
                        '<div class="leftSmallWhiteTab posAbs" style="left:0px;"></div>'+
                        '<div class="posAbs BGW" style="left:5px;width:101px;height:19px;border-top:solid 1px #d7d7d7;text-align:center;font-weight:bold;">Using Email</div>'+
                        '<div class="rightSmallWhiteTab posAbs" style="right:0px;"></div>'+
                    '</div>'+
                    "<div class='posRel BGW BOGL' style='width:585px;height:290px;'>"+
                        "<div class='posAbs F14 LH16' style='top:10px;width:585px;left:10px;'>Enter a valid email address:</div>"+
                        "<input type='text' style='position:absolute;top:30;left:10px;width:300px;' tabindex='2' name='divAlertEmail' id='divAlertEmail' value=''  onkeypress='return isEnglishAndSigns4Emails(event) || isNumber(event)' class='Standard' autocomplete='on'>"+
                        "<div class='posAbs F14 LH16' style='top:60px;width:585px;left:10px;'>Select one of these options:</div>"+
                            "<div style='position:absolute;left:10px;top:80px;'>"+
	                    "<input type='checkbox' id='StartRemind' name='StartRemind' value="+_SetMyProgId+" checked> Send a reminder when the show starts"+
	                    "</div>"+
	                    "<div style='position:absolute;left:10px;top:100px;'>"+
	                        "<input type='checkbox' id='RemindBef' name='RemindBef' value="+_SetMyProgId+" checked> Send a reminder 15 minutes before the show starts"+
	                    "</div>"+
	                    "<div style='position:absolute;left:10px;top:120px;'>"+
	                        "<input type='checkbox' id='RemindVod' name='RemindVod' value="+_SetMyProgId+" checked> Send an alert when a new video was recorded"+
	                    "</div>"+	                    
	                    "<div id='divSubscribeErr' class='F12 FB LH14 C_R posAbs' style='left:10px;top:210px;width:575'></div>"+
	                    "<div class='posAbs F14 LH16' style='left:10px;top:150px;width:575'>Confirm Security Code: <img src='../Functions/SecurityCode.asp?tc=28 28 28&bg=FF FF FF&clk="+today.getDay()+today.getMonth()+today.getFullYear()+today.getHours()+today.getMinutes()+today.getSeconds()+today.getMilliseconds()+"' style='width:86;height:21' /></div>"+
	                    "<input type='Text' maxlength='8' name='SecCode' id='SecCode' onkeypress='return isNumber(event)' style='position:absolute;left:10px;top:180px;width:300px;' class='Standard' />"+
	                     "<div class='posAbs' style='top:250px;left:207px;width:100px;height:20px;'>"+	
                            writeBlackButtonJS(100,"SUBSCRIBE","setTempUserAlerts("+_SetMyProgId+","+_SetMyStatus+","+_SetMyUserId+")")+		           	               
                         "</div>"+
                    "</div>"+
                    "<div class='posRel BGW BOGL' style='left:245px;top:20px;width:100px;height:20px;'>"+
	                    writeBlackButtonJS(100,"CLOSE","removeCustomAlert()")+
	                "</div>";
	     case 7: // schedule
	        var _scheduleDiv = true; 
	        var str="<input id='Schedule_Date' type='hidden'><input id='ScheduleDate' type='hidden'>"+ 
            "<div id='divScheduleStep1' class='divScheduleStep'>"+
                "<div class='posAbs' style='width:585px;height:80px; background-color:#353535;'>"+
                    "<img src='"+IMG_SERVER_URL+"Alert_info.gif' style='position:absolute;top:10px;left:5px;' />"+
                    "<div class='posAbs C_W' style='top:15px;left:75px;'>"+
                        "<b>Please note:</b><br />"+
                        "Scheduling your show in advance will help us promote it and get you more viewers. Not broadcasting a scheduled show may prevent us from promoting your shows."+
                    "</div>"+
                "</div>"+
                "<div style='position:absolute;width:585px;height:80px;top:90px;'>"+
                    "Your show name: <br /><b>"+myShowsAr[1]+"</b>"+
                    "<select id='scheduleShow' name='scheduleShow' style='width:100%;display:none;' onchange=$g('ScheduleTitle').value=this[this.selectedIndex].text>";
                        for(var i=0;i<myShowsAr.length;i+=2){
                            str+="<option value='"+myShowsAr[i]+"'>"+myShowsAr[i+1]+"</option>";
                        }
                    str+="</select><br />"+
                    "What will your next show be about?<br />"+
                    "<input id='ScheduleTitle' type='text' value='"+myShowsAr[1]+"' style='width:100%;color:#282828;'/>"+
                "</div>"+
                "<div style='position:absolute;top:170px;width:140px;height:140px;'>"+
                    "Date & Time:"+
                    "<div id='divCal' style='position:absolute;left:0px;top:20px;'></div>"+
                "</div>"+
                "<div style='position:absolute;left:160px;top:190px;width:380px;height:140px;'>"+
                    "<select name='Schedule_Hour' id='Schedule_Hour' style='width:65px;'>";
                            for(var i=0;i<24;i++){
                              var HH=(i<10)?"0"+i:i;
                              str+="<option value='"+i+"'>"+HH+"</option>";
                            }
                       
                str+="</select> : "+ 
                    "<select name='Schedule_Minute' id='Schedule_Minute' style='width:65px;'>"+
                        "<option value='0'>00</option>"+
                        "<option value='15'>15</option>"+
                        "<option value='30'>30</option>"+
                        "<option value='45'>45</option>"+
                    "</select>  "+
                    "<select name='Cycle' id='Cycle' style='width:100px;'>"+
                        "<option value='0'>One time</option>"+
                        "<option value='1'>Daily</option>"+
                        "<option value='2'>Weekly</option>"+
                    "</select><br /><br />"+
                    "This is your time:"+jsUserTimeZone+"<br /><br />"+
                    "<input id='CBRemindAlert' type='checkbox' style='position:absolute;top:60px;' checked/><font style='top:62px;position:absolute;left:25px;width:200px;'> Send an email reminder 15 minutes before the show starts</font>"+
                "</div>"+
                "<div class='posAbs' style='top:325;left:345;'>"+
                    writeBlackButtonJS(120,"FINISH","goToScheduleStep(2);") +
                "</div>"+
            "</div>" +
            "<div id='divScheduleStep2'  class='divScheduleStep'>"+
                "<div class='posAbs BGW BOGL' style='width:585px;height:270px;top:25px;left:0px;'>"+
                    "<div style='position:absolute;left:5px; top:5px;'>"+
                       " <div style='position:absolute;width:575; font-size:11px;'>"+
                            "Use this form to spread the word about your show or,<br />"+
                            "<div id='scheduleSendTo'></div><br /><br />"+
                        "</div>"+
                        "<div style='position:absolute;top:45px;width:575;'>Your message: </div>"+
                        "<div style='position:absolute;top:70px;'><textarea id='YourMailMsg' class='HPspradeLong' style='width:550px;height:70px;'></textarea></div>"+
                        "<div style='position:absolute;top:150px;width:575;'>Your friends emails:</div>"+
                        "<div style='position:absolute;top:175px; font-size:11px;'><textarea id='FEmails' class='HPspradeLong' style='width:260px;height:70px;overflow:auto;'></textarea><br>Separated by commas</div>"+
                    "</div>"+
                    "<div class='posAbs' style='top:300;left:280;'>"+
                        writeBlackButtonJS(120,'SEND','goToScheduleStep(3);') +
                    "</div>"+
                    "<div class='posAbs' style='top:300;left:420;'>"+
                        writeBlackButtonJS(120,'CLOSE','removeCustomAlert();') +
                    "</div>"+
                "</div>"+    
                "<div style='position:absolute;width:110px;height:19px;top:7px;left:-1px;'>"+
                    "<div class='leftSmallWhiteTab posAbs' style='left:0px;'></div>"+
                    "<div class='posAbs BGW' style='left:5px;width:101px;height:19px;border-top:solid 1px #d7d7d7; text-align:center;font-weight:bold;'>Using Email</div>"+
                    "<div class='rightSmallWhiteTab posAbs' style='right:0px;'></div>"+
                "</div>"+
                "<div style='position:absolute;left:114;width:110px;height:18px;top:7px;cursor:pointer;' onclick='goToScheduleStep(7)'>"+
                    "<div class='leftSmallWhiteDarkTab posAbs' style='left:0px;'></div>"+
                    "<div class='posAbs' style='left:5px;width:101px;height:18px;background-color:#C2C2C2;border-top:solid 1px #AFAFAF;text-align:center;font-weight:bold;'>Using Twitter</div>"+
                    "<div class='rightSmallWhiteDarkTab posAbs' style='right:0px;'></div>"+
                "</div>"+
            "</div>"+
            "<div id='divScheduleStep3' class='divScheduleStep'>"+
                "<div class='posAbs BGW BOGL' style='width:585px;height:270px;top:25px;left:0px;'>"+
                        "<div style='position:absolute;top:10px;left:5px;width:575px;'>Twitter user name: </div>"+
                        "<div style='position:absolute;top:10px;left:145px;'><input type='text'  value='Enter Username' id='YourName' class='Login' onfocus=claerText(this,'false');></div>"+
                        "<div style='position:absolute;top:35px;left:5px;width:575px;'>Twitter password: </div>"+
                        "<div style='position:absolute;top:35px;left:145px;'><input id='UserPsw' type='password' onfocus=ChangeBackPass('UserPsw') class='LoginPsw'/></div>"+
                        "<div style='position:absolute;top:65px;left:5px;width:575px;'>Your message: </div>"+
                        "<div style='position:absolute;top:90px;left:5px;'><textarea id='YourMsg' class='HPspradeLong'style='width:550px;height:70px;overflow:auto;'></textarea></div>"+
                        "<div style='position:absolute;top:170px;left:5px;'><input type='checkbox' name='saveTwitterDetails' id='saveTwitterDetails' onclick='CheckTwitterDetailsBox();' checked='checked' /> Save my twitter details</div>"+
                        "<div style='position:absolute;top:190px;left:5px;'><input type='checkbox' name='onStartBroadcast' id='onStartBroadcast' onclick='CheckStartBroadcastBox();' checked='checked' /> Update twitter every time I broadcast</div>"+
                        "<div style='position:absolute;top:220px;left:5px;width:585px;display:none;' id='twitterErrorDiv'></div>"+
                        "<div class='posAbs' style='top:300;left:140;'>"+
                            writeBlackButtonJS(120,'Save','twiterTogoToScheduleStep(0);') +
                        "</div>"+
                        "<div class='posAbs' style='top:300;left:280;'>"+
                            writeBlackButtonJS(120,'Update and Save','twiterTogoToScheduleStep(1);') +
                        "</div>"+
                        "<div class='posAbs' style='top:300;left:420;'>"+
                            writeBlackButtonJS(120,'CLOSE','removeCustomAlert();') +
                        "</div>"+
                "</div>"+ 
                "<div style='position:absolute;top:100px;left:240px;width:120px;height:120px;background-color:#000000;border:solid 1px #353535;display:none;' id='divSending'><embed width='120' height='120' src='"+IMG_SERVER_URL+"presender_green.swf' type='application/x-shockwave-flash' allowFullScreen='false'></embed></div>"+
                "<div style='position:absolute;width:110px;height:18px;top:7px;cursor:pointer;left:-1px;' onclick='goToScheduleStep(6)'>"+
                    "<div class='leftSmallWhiteDarkTab posAbs' style='left:0px;'></div>"+
                    "<div class='posAbs' style='left:5px;width:101px;height:18px;background-color:#C2C2C2;text-align:center;border-top:solid 1px #AFAFAF;font-weight:bold;'>Using Email</div>"+
                    "<div class='rightSmallWhiteDarkTab posAbs' style='right:0px;'></div>"+
                "</div>"+
                "<div style='position:absolute;left:114;width:110px;height:19px;top:7px;'>"+
                    "<div class='leftSmallWhiteTab posAbs' style='left:0px;'></div>"+
                    "<div class='posAbs BGW' style='left:5px;width:100px;height:19px;border-top:solid 1px #D7D7D7; text-align:center; font-weight:bold;'>Using Twitter</div>"+
                    "<div class='rightSmallWhiteTab posAbs' style='right:0px;'></div>"+
                "</div>"+
            "</div>"+
            "<div id='divScheduleStep4' class='divScheduleStep'>"+ 
                    "<div style=' position:absolute;width:585px;height:70px; background-color:#353535;'>"+
                        "<img src='"+IMG_SERVER_URL+"Alert_info.gif' style='position:absolute;top:5px;left:5px;' />"+
                        "<div class='posAbs C_W' style='top:15px;left:75px;'>"+
                            "<b>Success!</b><br />We got your schedule"+
                        "</div>"+
                    "</div>"+
                    "<div style='position:absolute;width:590px;height:80px;top:70px;'>"+
                        "<br />Here is your schedule widget to put on your site:"+
                        "<br />(You can copy the code & paste it anywhere!)"+
                    "</div>"+
                    "<div style='width:580px; height:20px;position:absolute;top:130px; '>"+
                        "<input type='text' id='txtClockEmbed' value='' onClick=javascript:$g('txtClockEmbed').focus();$g('txtClockEmbed').select(); readonly='true' value='' style='width:500px;height:20px;'/> "+
                        "<div class='posAbs' style='top:0px; left:580px;'>"+
                            writeBlackButtonJS(70,'Copy','copyInputStr("txtClockEmbed")') +
                        "</div>"+
                    "</div>"+
                    "<div id='ClockDiv' style='position:absolute;top:160px;left:180px;width:240px;height:140px;' ></div>"+
                    "<div class='posAbs' style='top:325px;left:280px'>"+
                        writeBlackButtonJS(120,'INVITE FRIENDS','goToScheduleStep(1);') +
                    "</div>"+
                    "<div class='posAbs' style='top:325px;left:430px;'>"+
                        writeBlackButtonJS(120,"CLOSE","removeCustomAlert();") +
                    "</div>"+
                    "</div>"+
           "</div>";
           
           return str;
       case 8:// Create Show div
	        return "<div id='divCreateShow' class='posRel BGW BOGL' style='width:585px;height:360px;'></div>";
	   case 9:// Edit User Links
	        return "<div class='posRel' style='width:585px;height:360px;'>"+
	                    "<div class='posAbs' style='width:585px;height:80px; background-color:#353535;'>"+
                        "<img src='"+IMG_SERVER_URL+"Alert_info.gif' style='position:absolute;top:10px;left:5px;' />"+
                        "<div class='posAbs C_W' style='top:15px;left:75px;'>"+
                            "<b>Please note:</b><br />"+
                            "This section allows you to put links to your favorite web page. <br>You can put up to 10 links."+
                        "</div>"+
                        "<div id='divUserLinks' class='posAbs' style='top:80px;width:585px;height:280px;'></div>"+
	               "</div>"+
	               "<div  class='posAbs' style='bottom:30px;width:182px;left:100px;'>"+writeBlackButtonJS(180,'SAVE AND CLOSE','saveUserLinksOrder();')+"</div>"+
	               "<div  class='posAbs' style='bottom:30px;width:122px;left:300px;'>"+writeBlackButtonJS(120,'CANCEL','removeCustomAlert();')+"</div>";
	   case 10:// Fonts & Colors     	        	                                
            var divTabs = '<div style="position:Relative;width:150px;height:19px;top:1px;left:-1px;z-index:+2">'+
                              '<div class="leftSmallWhiteTab posAbs" style="left:0px;"></div>'+
                              '<div class="posAbs BGW" style="left:5px;width:141px;height:19px;border-top:solid 1px #d7d7d7; text-align:center;font-weight:bold;">Fonts & Colors</div>'+
                              '<div class="rightSmallWhiteTab posAbs" style="right:0px;"></div>'+
                          '</div>'+
                          '<div style="position:absolute;left:154;width:110px;height:19px;top:1px;cursor:pointer;" onclick="setCurrentUserGlobalColors();setCustomAlertInnerHTML(GetDivInnerHTML(11));switchTab(2);">'+
                              '<div class="leftSmallWhiteDarkTab posAbs" style="left:0px;"></div>'+
                              '<div class="posAbs" style="left:5px;width:101px;height:19px;background-color:#C2C2C2;border-top:solid 1px #AFAFAF;text-align:center;font-weight:bold;">Page Banner</div>'+
                              '<div class="rightSmallWhiteDarkTab posAbs" style="right:0px;"></div>'+
                          '</div>'+ 
                          '<div style="position:absolute;left:270;width:150px;height:19px;top:1px;cursor:pointer;" onclick="setCurrentUserGlobalColors();setCustomAlertInnerHTML(GetDivInnerHTML(12));switchTab(1);">'+
                              '<div class="leftSmallWhiteDarkTab posAbs" style="left:0px;"></div>'+
                              '<div class="posAbs" style="left:5px;width:141px;height:19px;background-color:#C2C2C2;border-top:solid 1px #AFAFAF;text-align:center;font-weight:bold;">Background Picture</div>'+
                              '<div class="rightSmallWhiteDarkTab posAbs" style="right:0px;"></div>'+
                          '</div>'; 
                                                
            var divHtml =  "<div class='posRel BGW BOGL' style='width:585px;height:300px;'>"+          
                               "<div style='position:absolute;left:10px;top:65px;'>"+
                                   "<div style='position:absolute; left:10px; width:250px;'>Choose the box title font color: </div><div id='pickTitleColor' style='position:absolute; left:260px; width:18px; height:18px; background-color:Black; border:Solid 1px Black; cursor:pointer;' onclick='showColorPicker(this.parentNode.parentNode,this,$g(\"TitleColor\"),\"300\",\"60\");'></div><div style='position:absolute;left:300px;'><input type='Text' tabindex='11' name='TitleColor' id='TitleColor' alt='' title='' class='Login' maxlength='7' onchange='if(validhex(this.value.substr(1,6)) == true) {$g(\"pickTitleColor\").style.backgroundColor=this.value;_titleColor=this.value;};' /></div>"+
                               "</div>"+
                               "<div style='position:absolute;left:10px;top:90px;'>"+
                                   "<div style='position:absolute; left:10px; width:250px;'>Choose the box title background color: </div><div id='pickTitleBackgroundColor' style='position:absolute; left:260px; width:18px; height:18px; background-color:#D1D2CD; border:Solid 1px Black; cursor:pointer;' onclick='showColorPicker(this.parentNode.parentNode,this,$g(\"TitleBackgroundColor\"),\"300\",\"60\");'></div><div style='position:absolute;left:300px;'><input type='Text' tabindex='11' name='TitleBackgroundColor' id='TitleBackgroundColor' alt='' title='' class='Login' maxlength='7' onchange='if(validhex(this.value.substr(1,6)) == true) {$g(\"pickTitleBackgroundColor\").style.backgroundColor=this.value;_titleBackgroundColor = this.value;};' /></div>"+
                               "</div>"+
                               "<div style='position:absolute;left:10px;top:115px;'>"+
                                   "<div style='position:absolute; left:10px; width:250px;'>Choose the box content font color: </div><div id='pickContentColor' style='position:absolute; left:260px; width:18px; height:18px; background-color:Black; border:Solid 1px Black; cursor:pointer;' onclick='showColorPicker(this.parentNode.parentNode,this,$g(\"ContentColor\"),\"300\",\"60\");'></div><div style='position:absolute;left:300px;'><input type='Text' tabindex='11' name='ContentColor' id='ContentColor' alt='' title='' class='Login' maxlength='7' onchange='if(validhex(this.value.substr(1,6)) == true) {$g(\"pickContentColor\").style.backgroundColor=this.value;_contentColor = this.value;};' /></div>"+
                               "</div>"+
                               "<div style='position:absolute;left:10px;top:140px;'>"+
                                   "<div style='position:absolute; left:10px; width:250px;'>Choose the box content background color: </div><div id='pickContentBackgroundColor' style='position:absolute; left:260px; width:18px; height:18px; background-color:White; border:Solid 1px Black; cursor:pointer;' onclick='showColorPicker(this.parentNode.parentNode,this,$g(\"ContentBackgroundColor\"),\"300\",\"60\");'></div><div style='position:absolute;left:300px;'><input type='Text' tabindex='11' name='ContentBackgroundColor' id='ContentBackgroundColor' alt='' title='' class='Login' maxlength='7' onchange='if(validhex(this.value.substr(1,6)) == true) {$g(\"pickContentBackgroundColor\").style.backgroundColor=this.value;_contentBackgroundColor = this.value;};' /></div>"+
                               "</div>"+
                               "<div style='position:absolute;left:10px;top:180px;'>"+
                                   "<div class='UnLine CursorP' style='position:absolute; left:10px; width:250px;' onclick='restoreUserPageColors();'>Restore default values</div>"+
                               "</div>"+	                           
	                           "<div class='BGW BOGL' style='position:absolute;left:180px;top:270px;width:100px;height:20px;'>"+
	                               writeBlackButtonJS(100,"Cancel","removeCustomAlert()")+
	                           "</div>"+
	                           "<div class='BGW BOGL' style='position:absolute;left:300px;top:270px;width:100px;height:20px;'>"+
	                               writeBlackButtonJS(100,"Save","saveCustomization()")+
	                           "</div>"+
	                           "<div class='BGW BOGL' style='position:absolute;left:470px;top:270px;width:100px;height:20px;'>"+
	                               writeBlackButtonJS(150,"Save and Close","saveCloseCustomization()")+
	                           "</div>"+
	                           "<div style='position:absolute;left:260px;top:250px;'>"+
	                               "<div id='messageDiv' style='position:absolute; left:10px; width:250px; font-size:12px; color:red; text-align:center; display:none;'></div>"+
	                           "</div>"+
                           "</div>";                                    
	        
	        return divTabs + divHtml;
	   case 11:// Page Banner	                    
	        if(_banner != "")
	        {
	            radio1 = "";
	            radio2 = "checked";	            
	        }
	        else
	        {
	            radio1 = "checked";
	            radio2 = "";
	        }
            var divTabs = '<div style="position:Relative;width:150px;height:19px;top:1px;left:-1px;cursor:pointer;" onclick="setCurrentUserGlobalBanner();setCustomAlertInnerHTML(GetDivInnerHTML(10));setCurrentUserPageColors();">'+
                              '<div class="leftSmallWhiteDarkTab posAbs" style="left:0px;"></div>'+
                              '<div class="posAbs" style="left:5px;width:141px;height:19px;background-color:#C2C2C2;border-top:solid 1px #AFAFAF;text-align:center;font-weight:bold;">Fonts & Colors</div>'+
                              '<div class="rightSmallWhiteDarkTab posAbs" style="right:0px;"></div>'+
                          '</div>'+
                          '<div style="position:absolute;left:154;width:110px;height:19px;top:1px;z-index:+2;" >'+
                              '<div class="leftSmallWhiteTab posAbs" style="left:0px;"></div>'+
                              '<div class="posAbs BGW" style="left:5px;width:101px;height:19px;border-top:solid 1px #d7d7d7; text-align:center;font-weight:bold;">Page Banner</div>'+
                              '<div class="rightSmallWhiteTab posAbs" style="right:0px;"></div>'+
                          '</div>'+ 
                          '<div style="position:absolute;left:270;width:150px;height:19px;top:1px;cursor:pointer;" onclick="setCurrentUserGlobalBanner();setCustomAlertInnerHTML(GetDivInnerHTML(12));switchTab(1);">'+
                              '<div class="leftSmallWhiteDarkTab posAbs" style="left:0px;"></div>'+
                              '<div class="posAbs" style="left:5px;width:141px;height:19px;background-color:#C2C2C2;border-top:solid 1px #AFAFAF;text-align:center;font-weight:bold;">Background Picture</div>'+
                              '<div class="rightSmallWhiteDarkTab posAbs" style="right:0px;"></div>'+
                          '</div>'; 
             
            var divHtml =  "<div class='posRel BGW BOGL' style='width:585px;height:300px;'>"+          
                               "<div style='position:absolute;left:10px;top:25px;'>"+
                                   "Upload your page banner:"+
                               "</div>"+
                               "<div style='position:absolute;left:10px;top:60px;'>"+
                                   "<div style='position:absolute;left:10px;width:300px;'><input type='radio' name='divBackgroundPicture' id='divBackgroundNone' alt='' title='' onclick='radioBanner(0);' "+radio1+" /> None</div>"+
                               "</div>"+
                               "<div style='position:absolute;left:10px;top:90px;'>"+
                                   "<div style='position:absolute;left:10px;width:300px;'><input type='radio' name='divBackgroundPicture' id='divBackgroundPicture' alt='' title='' onclick='radioBanner(1);' "+radio2+" /> Upload your own page banner</div>"+
                               "</div>"+
                               "<div id='divImg' style='position:absolute;left:10px;top:120px;display:none;'>"+
                                   "<div style='position:relative;width:300px;'>"+
                                       "<div style='position:absolute;left:30px;width:300px;top:0px;'>"+
                                           "<input type='Hidden' id='ImgName' name='ImgName' value='' />"+
                                           "<input type='Hidden' id='ImgId' name='ImgId' value='' />"+
                                           "<input type='Hidden' id='ApplicationId' name='ApplicationId' value='' />"+
                                           "<input type='Hidden' id='AlbumId' name='AlbumId' value='' />"+
                                           "<input type='Hidden' id='SourchAlbumId' name='SourchAlbumId' value='' />"+
                                           "<input type='Hidden' id='BGColor' name='BGColor' value='' />"+
                                       "</div>"+     
                                       "<div style='position:absolute;left:30px;width:300px;top:0px;'>"+
                                           "<iframe scrolling='no' class='iframe' id='theFrame' src='/Include/Upload.asp?UploadType=BannerUpload' marginheight='0' marginwidth='0' frameborder='0'></iframe>"+
                                       "</div>"+
                                       "<div style='position:absolute;left:30px;width:300px;top:25px;'>"+
                                           "<div style='font-size:9px;'>"
                                           if(_isProAccount=="True")
                                           {divHtml+="Upload a 990X140 pixels JPG or GIF or SWF file"}
                                           else
                                            {divHtml+="Upload a 990X140 pixels JPG or GIF file"}                                    
                                           divHtml+= "</div>"+                                            
                                       "</div>"+
                                       "<div id='ErrTd' style='position:absolute;left:300px;width:250px;top:25px;'></div>"+
                                       "<div style='position:absolute;left:30px;width:300px;top:50px;'>"+
                                           "<img id='TheImg' src='' alt='' style='width:129px; height:96px;' onload='fileLodedFlag = true;_banner = this.src;' />"+
                                           "<div id='TheFlashBanner' style='left:0px; top:0px;width:129px; height:96px;over-flow:scroll;display:none;'></div>"+                                           
                                       "</div>"+                                       
                                   "</div>"+
                               "</div>"+
	                           "<div class='BGW BOGL' style='position:absolute;left:180px;top:270px;width:100px;height:20px;'>"+
	                               writeBlackButtonJS(100,"Cancel","removeCustomAlert()")+
	                           "</div>"+
	                           "<div class='BGW BOGL' style='position:absolute;left:300px;top:270px;width:100px;height:20px;'>"+
	                               writeBlackButtonJS(100,"Save","saveCustomization()")+
	                           "</div>"+
	                           "<div class='BGW BOGL' style='position:absolute;left:470px;top:270px;width:100px;height:20px;'>"+
	                               writeBlackButtonJS(150,"Save and Close","saveCloseCustomization()")+
	                           "</div>"+
	                           "<div style='position:absolute;left:260px;top:250px;'>"+
	                               "<div id='messageDiv' style='position:absolute; left:10px; width:250px; font-size:12px; color:red; text-align:center; display:none;'></div>"+
	                           "</div>"+
                           "</div>";                                               
                           	        		        
	        return divTabs + divHtml;
	   case 12:// Background Picture	   	        	   
	        	        
	        if(_backgroundPicture != "")
	        {
	            radio1 = "";
	            radio2 = "checked";	            
	        }
	        else
	        {
	            radio1 = "checked";
	            radio2 = "";
	        }
	        
	        if(_backgroundPictureLayout == 1)
	        {
	            radioLayout1 = "";
	            radioLayout2 = "checked";	            
	        }
	        else
	        {
	            radioLayout1 = "checked";
	            radioLayout2 = "";
	        }
	        
            var divTabs = '<div style="position:Relative;width:150px;height:19px;top:1px;left:-1px;cursor:pointer;" onclick="setCurrentUserGlobalBackgroundPicture();setCustomAlertInnerHTML(GetDivInnerHTML(10));setCurrentUserPageColors();">'+
                              '<div class="leftSmallWhiteDarkTab posAbs" style="left:0px;"></div>'+
                              '<div class="posAbs" style="left:5px;width:141px;height:19px;background-color:#C2C2C2;border-top:solid 1px #AFAFAF;text-align:center;font-weight:bold;">Fonts & Colors</div>'+
                              '<div class="rightSmallWhiteDarkTab posAbs" style="right:0px;"></div>'+
                          '</div>'+
                          '<div style="position:absolute;left:154;width:110px;height:19px;top:1px;cursor:pointer;" onclick="setCurrentUserGlobalBackgroundPicture();setCustomAlertInnerHTML(GetDivInnerHTML(11));switchTab(2);">'+
                              '<div class="leftSmallWhiteDarkTab posAbs" style="left:0px;"></div>'+
                              '<div class="posAbs" style="left:5px;width:101px;height:19px;background-color:#C2C2C2;border-top:solid 1px #AFAFAF;text-align:center;font-weight:bold;">Page Banner</div>'+
                              '<div class="rightSmallWhiteDarkTab posAbs" style="right:0px;"></div>'+
                          '</div>'+ 
                          '<div style="position:absolute;left:270;width:150px;height:19px;top:1px;z-index:+2;">'+
                              '<div class="leftSmallWhiteTab posAbs" style="left:0px;"></div>'+
                              '<div class="posAbs BGW" style="left:5px;width:141px;height:19px;border-top:solid 1px #d7d7d7; text-align:center;font-weight:bold;">Background Picture</div>'+
                              '<div class="rightSmallWhiteTab posAbs" style="right:0px;"></div>'+
                          '</div>'; 
                                                
            var divHtml =  "<div class='posRel BGW BOGL' style='width:585px;height:300px;'>"+          
                               "<div style='position:absolute;left:10px;top:25px;'>"+
                                   "Upload your page background picture:"+
                               "</div>"+
                               "<div style='position:absolute;left:10px;top:60px;'>"+
                                   "<div style='position:absolute;left:10px;width:300px;'><input type='radio' name='divBackgroundPicture' id='divBackgroundNone' alt='' title='' onclick='radioBackgroundPicture(0);' "+radio1+" /> None</div>"+
                               "</div>"+
                               "<div style='position:absolute;left:10px;top:90px;'>"+
                                   "<div style='position:absolute;left:10px;width:300px;'><input type='radio' name='divBackgroundPicture' id='divBackgroundPicture' alt='' title='' onclick='radioBackgroundPicture(1);' "+radio2+" /> Upload your own background picture</div>"+
                               "</div>"+
                               "<div id='divImg' style='position:absolute;left:10px;top:120px;display:none;'>"+
                                   "<div style='position:relative;width:300px;'>"+
                                       "<div style='position:absolute;left:30px;width:300px;top:0px;'>"+
                                           "<input type='Hidden' id='ImgName' name='ImgName' value='' />"+
                                           "<input type='Hidden' id='ImgId' name='ImgId' value='' />"+
                                           "<input type='Hidden' id='ApplicationId' name='ApplicationId' value='' />"+
                                           "<input type='Hidden' id='AlbumId' name='AlbumId' value='' />"+
                                           "<input type='Hidden' id='SourchAlbumId' name='SourchAlbumId' value='' />"+
                                           "<input type='Hidden' id='BGColor' name='BGColor' value='' />"+
                                       "</div>"+     
                                       "<div style='position:absolute;left:30px;width:300px;top:0px;'>"+
                                           "<iframe scrolling='no' class='iframe' id='theFrame' src='/Include/Upload.asp?UploadType=BackgroundPictureUpload' marginheight='0' marginwidth='0' frameborder='0'></iframe>"+
                                       "</div>"+
                                       "<div style='position:absolute;left:30px;width:300px;top:25px;'>"+
                                           "<div style='font-size:9px;'>Upload a JPG or GIF file</div>"+
                                       "</div>"+
                                       "<div id='ErrTd' style='position:absolute;left:350px;width:200px;top:25px;'></div>"+
                                       "<div style='position:absolute;left:30px;width:300px;top:50px;'>"+
                                           "<img id='TheImg' src='' alt='' style='width:129px; height:96px;' onload='fileLodedFlag = true;_backgroundPicture = this.src;'/>"+
                                            "<div id='TheFlashBanner' style='width:129px; height:96px;over-flow:scroll;display:none;'></div>"+
                                            
                                       "</div>"+
                                   "</div>"+
                               "</div>"+
                               "<div id='divLayout' style='position:absolute;left:250px;top:130px;display:none;'>"+
                                   "<div style='position:relative;width:300px;'>"+
                                       "<div style='position:absolute;left:30px;width:300px;top:0px;'>"+
                                           "<input type='Hidden' id='BackgroundPictureLayout' name='BackgroundPictureLayout' value='0' />"+
                                           "<div>layout</div>"+
                                       "</div>"+
                                       "<div style='position:absolute;left:30px;width:300px;top:20px;'>"+
                                           "<div style='position:absolute;left:10px;width:300px;'><input type='radio' name='Layout' id='Tile' alt='' title='' onclick='$g(\"BackgroundPictureLayout\").value=\"0\";_backgroundPictureLayout = 0;' " + radioLayout1 + " />Tile</div>"+
                                       "</div>"+
                                       "<div style='position:absolute;left:30px;width:300px;top:40px;'>"+
                                           "<div style='position:absolute;left:10px;width:300px;'><input type='radio' name='Layout' id='Center' alt='' title='' onclick='$g(\"BackgroundPictureLayout\").value=\"1\";_backgroundPictureLayout = 1;' " + radioLayout2 + " />Center</div>"+
                                       "</div>"+
                                       "<!--div style='position:absolute;left:30px;width:300px;top:60px;'>"+
                                           "<div style='position:absolute;left:10px;width:300px;'><input type='radio' name='Layout' id='Stretch' alt='' title='' onclick='$g(\"BackgroundPictureLayout\").value=\"2\";_backgroundPictureLayout = 2;' " + _layoutStreched + " />Stretch</div>"+
                                       "</div-->"+
                                   "</div>"+
                               "</div>"+
                               "<div class='BGW BOGL' style='position:absolute;left:180px;top:270px;width:100px;height:20px;'>"+
	                               writeBlackButtonJS(100,"Cancel","removeCustomAlert()")+
	                           "</div>"+
	                           "<div class='BGW BOGL' style='position:absolute;left:300px;top:270px;width:100px;height:20px;'>"+
	                               writeBlackButtonJS(100,"Save","saveCustomization()")+
	                           "</div>"+
	                           "<div class='BGW BOGL' style='position:absolute;left:470px;top:270px;width:100px;height:20px;'>"+
	                               writeBlackButtonJS(150,"Save and Close","saveCloseCustomization()")+
	                           "</div>"+
	                           "<div style='position:absolute;left:260px;top:250px;'>"+
	                               "<div id='messageDiv' style='position:absolute; left:10px; width:250px; font-size:12px; color:red; text-align:center; display:none;'></div>"+
	                           "</div>"+
                           "</div>";
                          	        	        	    
	        return divTabs + divHtml; 
	   case 13: // PlayGround	
	       var str="<div class='posRel' style='width:585px;height:360px;'>"+
	                    "<div class='posAbs' style='width:585px;height:80px; background-color:#353535;'>"+
                        "<img src='"+IMG_SERVER_URL+"Alert_info.gif' style='position:absolute;top:10px;left:5px;' />"+
                        "<div class='posAbs C_W' style='top:15px;left:75px;'>"+
                            "<b>Please note:</b><br />"+
                            "BlogTV is not responsible for the content produced by the code that you embed in your profile. Make sure that the content you display complies with the <a class='C_W' href='/InfoPage.asp?showInfo=2' target='_blank'>terms of use</a>."+
                        "</div>"+
                        "<div id='divMyPG' class='posAbs FB' style='top:90px;width:585px;height:20px;'>Insert your code here: <small>(Scripts and iframe are not allowed)</small></div>"+
                        "<div id='divMyPG' class='posAbs' style='top:110px;width:585px;height:260px;'><textarea id='txtEmbedCode' style='width:582;height:205'></textarea><input type='hidden' id='pgType'/><input type='hidden' id='pgID'/></div>"+
	               "</div>"+
	               "<div  class='posAbs' style='bottom:30px;width:122px;left:350px;'>"+writeBlackButtonJS(150,'SAVE AND CLOSE','setPlayGroundCode();')+"</div>"+
	               "<div  class='posAbs' style='bottom:30px;width:122px;left:170px;'>"+writeBlackButtonJS(120,'CANCEL','removeCustomAlert();')+"</div>"; 
        return str;
        case 15:// New Reg Div
            return "<div id='divRegistry' style='position:absolute;width:760px; height:500px;left:0px; top:0px;'></div>";
        case 16:            
            var divHtml =   "<div id='divLogIn' class='posRel' style='width:752px; height:242px; left:0px; top:0px; border:1px solid #D7D7D7;'>"+
                                "<div class='posAbs BGGR BOGLGR' style='width:740px; height:19px; left:5px; top:5px;'>"+
                                    "<div class='posRel C_W FB FH14 F14' style='left:7px; top:3px;'>LOGIN or <a class='UnLine CursorP C_W UCase' onclick='setSignIn();' title='join us'>join us</a></div>"+
                                    "<div id='divAlertTitleCloseImg' class='xDivIcon' onclick='removeCustomAlert();'></div>"+
                                "</div>"+
                                "<div class='posRel' style='width:740px; height:205px; left:5px; top:30px; border:1px solid #D7D7D7;'>"+
                                    "<div class='posAbs F12 FB C_GD' style='width:585px; left:5px; top:5px;'>You must be logged in to use this feature</div>"+
                                    "<div class='posAbs F12 FB C_GD' style='width:585px; left:5px; top:50px;'>User name:</div>"+
                                    "<div class='posAbs' style='left:120px; top:50px;'>"+
                                        "<input type='Text' tabindex='10' name='divUserName' id='divUserName' onkeypress='return isEnglish(event) || isNumber(event) || isSigns(event,1,this.value);' alt='Enter Username' title='Enter Username' value='Enter Username' onfocus='claerMe(this);' autocomplete='on' class='Standard_white' style='width:195px; height:20px;' />"+
                                    "</div>"+
                                    "<div class='posAbs F12 FB C_GD' style='width:585px; left:5px; top:80px;'>Password:</div>"+
                                    "<div class='posAbs' style='left:120px; top:80px;'>"+
                                        "<input type='Password' tabindex='11' name='divUserPsw' id='divUserPsw' onkeypress='CheckForEnterDiv(event,16)' value='' alt='Enter Password' title='Enter Password' onfocus=ChangeBackPass('divUserPsw'); autocomplete='on' class='Standard_white' style='width:195px; height:20px;' />"+
                                        "<!--a onclick='setCustomAlertInnerHTML(GetDivInnerHTML(2));' class='posAbs UnLine CursorP F9 LH10 C_GD' style='top:5px; left:230px; width:100px;' tabindex='3' title='Forgot your password?'>Forgot your password?</a-->"+
                                    "</div>"+
                                    "<div id='divLoginErr' class='posAbs F11 FB' style='left:120px; top:100px; color:#ed1c24;'></div>"+
                                    "<div class='posAbs F10 C_GD' style='left:5px; top:120px;'>NEW USER? <a class='UnLine CursorP' onclick='setSignIn();' title='join us'>join us!</a></div>"+
                                    "<div class='posAbs' style='left:430px; top:170px;'>"+
                                        writeGreenButtonJS(91,"GO!","Login(16);")+
                                    "</div>"+
                                    "<div class='posAbs' style='right:20px; top:20px;'>"+
                                        "<img src='"+IMG_SERVER_URL+"logInDiv!.jpg' title='' alt='' width='80' height='100' />"+
                                    "</div>"+
                                "</div>"
                            "</div>";
            
            return divHtml;
       case 17: // Browser Err Msg
          var Browser_Compatible_Msg = "Hello<br>BlogTV is most compatible with Firefox and Internet Explorer so you may experience some difficulty using ^^BroesweName^^ with blogTV. ";
              Browser_Compatible_Msg = Browser_Compatible_Msg.replace(/\^\^BroesweName\^\^/g, BrowserDetect.browser); 
          var divHtml = 
                    "<div class='posRel BGW BOGL' style='width:585px;height:80px;'>"+
	                   "<div style='position:absolute;left:25px; right:25px; top:15px;'>"+
	                    Browser_Compatible_Msg + 
	                   "</div>"+	                   	               
	               "</div>"+
	               "<div class='posRel TxtC' style='top:5px;left:230px;width:130px;height:20px;'>"+
	               writeBlackButtonJS(120,"Close","removeCustomAlert();")+	           
	               "</div>";  
         return divHtml;
    }
}

var _SetMyProgId=0;
var _SetMyStatus=0;
var _SetMyUserId=0;
var _SetOwnerUserId=0;
var _SetOwnerUserName="";
function ChangeSubscribeDiv()    
{
    if(_SetMyStatus==0){
        SubscriptionStr = "UnSubscribe";
        aInnerHtml=SetInnerDivContent(0);
    }else{
        SubscriptionStr = "Subscribe";
    }
    SubObj = $n("Subscribe")    
    for(s=0;s<SubObj.length;s++){                   
        SubObj[s].onclick = function(){SetMyProgramHpDiv(_SetMyProgId, (1-_SetMyStatus),_SetMyUserId, _SetOwnerUserName)};
        SubObj[s].title = SubscriptionStr;
        if(SubObj[s].innerHTML!="")
            SubObj[s].innerHTML = SubscriptionStr;
    }   
    
   
}

function SetMyProgramHpDiv(ProgramId, MyProgramStatus,TuserId, TuserName)    
{
 aInnerHtml = "";
 _SetMyProgId=ProgramId;
 _SetMyStatus=MyProgramStatus;;
 _SetMyUserId=TuserId;
 _SetOwnerUserName = TuserName; 
 insertFlag = 'false';
 
 if(TuserId!=0){   
    if(MyProgramStatus==0){          
        url = "/Ajax/My_CheckUserSubscriptions.asp";
        str = "ShowId="+_SetMyProgId;
        objMyXML = CreateObjXML();
        objMyXML.open("POST", url ,true); 
        objMyXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
        objMyXML.onreadystatechange = batchCheckSubScribe;
        objMyXML.send(str);
        
    }else{
        User_UnSubscribe(_SetMyProgId)
    }
    
 }	
 else{
	LogInDiv()  
    }	
    
}

function batchCheckSubScribe()
{
    if (objMyXML && objMyXML.readyState==4){
        if (objMyXML.responseXML)
        {  
           var MySub = objMyXML.responseXML.getElementsByTagName("MySub")                
               MySub = MySub[0].firstChild.data; 
            
            if(MySub=="1")
                writeUnSubDiv();
            else
                writeSubDiv();                
        }
     }
    
}


function imposeMaxLength(Object, MaxLen)
{ 
 if(Object.value.length>130){
    writeErrorMessage("twitterErrorDiv","Message is limited to 140 characters.");
    Object.value= Object.value.substring(0,MaxLen);
  }
}
function setTempUserAlerts(ProgramId, MyProgramStatus,TuserId){
    var BR=0;
    var SR=0;
    var RV=0;
    var RemindVod = $g("RemindVod");
    var tuEmail=$g("divAlertEmail").value;
    var tuSecCode=$g("SecCode").value;
    if($g("StartRemind").checked) SR=StartRemind.value;
    if($g("RemindBef").checked) BR=RemindBef.value;
    if(RemindVod.checked) RV=RemindVod.value;
    
    url = "/Ajax/Alerts_TempUserAlerts.asp";
    str = "UserEmail="+tuEmail+"&SecCode="+tuSecCode+"&ProgramId="+ProgramId+"&Status="+MyProgramStatus+"&SR="+SR+"&BR="+BR+"&RV="+RV;
    objMyXML = CreateObjXML();
    objMyXML.open("POST", url ,true); 
    objMyXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objMyXML.onreadystatechange = batchTempUserAlerts;
    objMyXML.send(str);    
}
function batchTempUserAlerts(){
    if (objMyXML && objMyXML.readyState==4){
        if (objMyXML.responseXML)
		{  
            var Str = objMyXML.responseXML.getElementsByTagName("ErrDesc");
            Str = Str[0].firstChild.data;
            $g("divSubscribeErr").innerHTML=Str;
        }
     }
}

// Edit & Update User Page Colors
function customizeUserPage(TuserId)
{
    _SetMyUserId=TuserId;    
    //divTitle="Customize Page";    
    if(TuserId!=0)
    {
	    aInnerHtml=GetDivInnerHTML(10);
	}    
    else
    {
	    aInnerHtml=GetDivInnerHTML(1);        
    }    
	createCustomAlert("Customize Page",aInnerHtml,"605","405","","");	
	setTimeout("setCurrentUserPageColors();",300);
}

// Update User Page Colors
function saveUserPageColors()
{  
    var titleColor =_titleColor;
    var titleBackgroundColor =_titleBackgroundColor;
    var contentColor =_contentColor;
    var contentBackgroundColor = _contentBackgroundColor; 
        
    if (titleColor.indexOf("#") != 0 || titleColor.length != 7 || validhex(titleColor.substr(1,6)) != true)
    {
        $g("messageDiv").innerHTML = "Wrong color number - try again";
        $g("messageDiv").style.display='block';        
        setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
        return false;
    }
    if (titleBackgroundColor.indexOf("#") != 0 || titleBackgroundColor.length != 7  || validhex(titleBackgroundColor.substr(1,6)) != true)
    {
        $g("messageDiv").innerHTML = "Wrong color number - try again";
        $g("messageDiv").style.display='block';        
        setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
        return false;
    }
    if (contentColor.indexOf("#") != 0 || contentColor.length != 7  || validhex(contentColor.substr(1,6)) != true)
    {
        $g("messageDiv").innerHTML = "Wrong color number - try again";
        $g("messageDiv").style.display='block';        
        setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
        return false;
    }
    if (contentBackgroundColor.indexOf("#") != 0 || contentBackgroundColor.length != 7  || validhex(contentBackgroundColor.substr(1,6)) != true)
    {
        $g("messageDiv").innerHTML = "Wrong color number - try again";
        $g("messageDiv").style.display='block';        
        setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
        return false;
    }

    
    url = "/Ajax/Users_UpdateUserPageColors.asp";
    str = "UserId="+_SetMyUserId+"&TitleColor="+titleColor+"&TitleBackgroundColor="+titleBackgroundColor+"&ContentColor="+contentColor+"&ContentBackgroundColor="+contentBackgroundColor;
    objMyXML = CreateObjXML();
    objMyXML.open("POST", url ,true); 
    objMyXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objMyXML.onreadystatechange = batchUserPageColors;
    objMyXML.send(str);
}

//
function batchUserPageColors()
{
    if (objMyXML && objMyXML.readyState==4)
    {
        if (objMyXML.responseXML)
		{  
            var Str = objMyXML.responseXML.getElementsByTagName("ErrDesc");
            Str = Str[0].firstChild.data;            
            
            if ($g("messageDiv") != null)
            {                        
                $g("messageDiv").innerHTML = "Saved";
                $g("messageDiv").style.display='block';                
                setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
            }           
                      
            var cssRules;
	        if (document.all) 
	        {
	          cssRules = 'rules';
	        }
	        else if (document.getElementById) 
	        {
	           cssRules = 'cssRules';
	        }
	        var cssArrayNum = 3;  
	        for (var R = 0; R < document.styleSheets[cssArrayNum][cssRules].length; R++) 
	        {
	           switch(document.styleSheets[cssArrayNum][cssRules][R].selectorText)
	           {
	            case ".userForeColor":
        	        document.styleSheets[cssArrayNum][cssRules][R].style["color"] = _contentColor;
        	        break;
        	    case ".userLinkColor":
        	        document.styleSheets[cssArrayNum][cssRules][R].style["color"] = _contentColor;
        	        break;
        	    case ".userTitleForeColor":
        	        document.styleSheets[cssArrayNum][cssRules][R].style["color"] = _titleColor;
        	        break;
        	    case ".userBoxBG":
        	        document.styleSheets[cssArrayNum][cssRules][R].style["background"] = _contentBackgroundColor;
        	        break;
        	    case ".userBoxTitleBg":
        	        document.styleSheets[cssArrayNum][cssRules][R].style["background"] = _titleBackgroundColor;
        	        break;
	           }
	        }        
        }
     }
}

// Upload Background Picture
function uploadBackgroundPicture()
{        
    var img = _backgroundPicture;
    var imgArry = img.split("Temp/");
    var imgFile = imgArry[1] ;
    if (imgFile == undefined && img.length > 0) 
    {
        imgArry = img.split("site/");
        imgFile = imgArry[1] ;        
    }
    if (imgFile == undefined)
    {
        imgFile = '';
    }
         
    var backgroundPictureLayout = _backgroundPictureLayout; 
     
    url = "/Ajax/Users_UpdateUserPageBackgroundPicture.asp";
    str = "UserId="+_SetMyUserId+"&ImgFile="+imgFile+"&backgroundPictureLayout="+backgroundPictureLayout;
    objMyXML = CreateObjXML();
    objMyXML.open("POST", url ,true); 
    objMyXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objMyXML.onreadystatechange = batchUserPageBackgroundPicture;
    objMyXML.send(str);
}

//
function batchUserPageBackgroundPicture()
{    
    if (objMyXML && objMyXML.readyState==4)
    {
        if (objMyXML.responseXML)
		{  
            var Str = objMyXML.responseXML.getElementsByTagName("ErrDesc");
            Str = Str[0].firstChild.data;
            
            if ($g("messageDiv") != null)
            {                        
                $g("messageDiv").innerHTML = "Saved";
                $g("messageDiv").style.display='block';                
                setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
            }                                                           
                        
            _backgroundPicture = _backgroundPicture.replace("Temp","site");
            if (_backgroundPicture.indexOf("People") > 0)
            {
                _backgroundPicture = "";
            } 
            document.body.style.backgroundImage = "url(" + _backgroundPicture + ")";
            if (_backgroundPictureLayout == 0)
            {
                document.body.style.backgroundRepeat = "repeat";
                document.body.style.backgroundAttachment = "";
                document.body.style.backgroundPosition = "";
            }
            if (_backgroundPictureLayout == 1)
            {
                document.body.style.backgroundRepeat = "no-repeat";
                document.body.style.backgroundAttachment = "fixed";
                document.body.style.backgroundPosition = "Center Center";
            }                       
        }
     }
}

// Upload Banner
function uploadBanner()
{   
    var img = _banner;
    var imgArry = img.split("Temp/");
    var imgFile = imgArry[1] ;
    if (imgFile == undefined && img.length > 0) 
    {
        imgArry = img.split("site/");
        imgFile = imgArry[1] ;        
    }
    if (imgFile == undefined)
    {
        imgFile = '';
    }            
              
    url = "/Ajax/Users_UpdateUserPageBanner.asp";
    str = "UserId="+_SetMyUserId+"&ImgFile="+imgFile;
    objMyXML = CreateObjXML();
    objMyXML.open("POST", url ,true); 
    objMyXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objMyXML.onreadystatechange = batchUserPageBanner;
    objMyXML.send(str);
}

//
function batchUserPageBanner()
{
    if (objMyXML && objMyXML.readyState==4)
    {
        if (objMyXML.responseXML)
		{  
            var Str = objMyXML.responseXML.getElementsByTagName("ErrDesc");
            Str = Str[0].firstChild.data;
            
            if ($g("messageDiv") != null)
            {                        
                $g("messageDiv").innerHTML = "Saved";
                $g("messageDiv").style.display='block';                
                setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
            }            
                                    
            _banner = _banner.replace("Temp","site");            
            if (_banner.indexOf("People") > 0)
            {
                _banner = "";
            }
            $g("BannerImg").src = _banner;
            if (_banner == "")
            {
                $g("BannerImg").style.display = "none";
            }
            else            {
                
                $g("BannerImg").style.display = "block";
            }            
        }
     }
}

// save all Customization values
function saveCustomization()
{
    // Colors
    setCurrentUserGlobalColors();
    var titleColor =_titleColor;
    var titleBackgroundColor =_titleBackgroundColor;
    var contentColor =_contentColor;
    var contentBackgroundColor = _contentBackgroundColor;     
        
    if (titleColor.indexOf("#") != 0 || titleColor.length != 7 || validhex(titleColor.substr(1,6)) != true)
    {
        $g("messageDiv").innerHTML = "Wrong color number - try again";
        $g("messageDiv").style.display='block';        
        setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
        return false;
    }
    if (titleBackgroundColor.indexOf("#") != 0 || titleBackgroundColor.length != 7  || validhex(titleBackgroundColor.substr(1,6)) != true)
    {
        $g("messageDiv").innerHTML = "Wrong color number - try again";
        $g("messageDiv").style.display='block';        
        setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
        return false;
    }
    if (contentColor.indexOf("#") != 0 || contentColor.length != 7  || validhex(contentColor.substr(1,6)) != true)
    {
        $g("messageDiv").innerHTML = "Wrong color number - try again";
        $g("messageDiv").style.display='block';        
        setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
        return false;
    }
    if (contentBackgroundColor.indexOf("#") != 0 || contentBackgroundColor.length != 7  || validhex(contentBackgroundColor.substr(1,6)) != true)
    {
        $g("messageDiv").innerHTML = "Wrong color number - try again";
        $g("messageDiv").style.display='block';        
        setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
        return false;
    }
    
    // Banner    
    var imgbanner = _banner;    
    var imgArrybanner = imgbanner.split("Temp/");
    var imgFilebanner = imgArrybanner[1] ;
    if (imgFilebanner == undefined && imgbanner.length > 0) 
    {
        imgArrybanner = imgbanner.split("site/");
        imgFilebanner = imgArrybanner[1] ;        
    }
    if (imgFilebanner == undefined)
    {
        imgFilebanner = '';
    }     
    // BackgroundPicture
    //alert("backgroundPicture = " + _backgroundPicture);
    var imgbackgroundPicture = _backgroundPicture;
    var imgArrybackgroundPicture = imgbackgroundPicture.split("Temp/");
    var imgFilebackgroundPicture = imgArrybackgroundPicture[1] ;
    if (imgFilebackgroundPicture == undefined && imgbackgroundPicture.length > 0) 
    {
        imgArrybackgroundPicture = imgbackgroundPicture.split("site/");
        imgFilebackgroundPicture = imgArrybackgroundPicture[1] ;        
    }
    if (imgFilebackgroundPicture == undefined)
    {
        imgFilebackgroundPicture = '';
    }         
    //alert("_backgroundPictureLayout = " + _backgroundPictureLayout);
    var backgroundPictureLayout = _backgroundPictureLayout; 

    
    url = "/Ajax/Users_UpdateUserPageCustomization.asp";
    str = "UserId="+_SetMyUserId+"&TitleColor="+titleColor+"&TitleBackgroundColor="+titleBackgroundColor+"&ContentColor="+contentColor+"&ContentBackgroundColor="+contentBackgroundColor+"&imgFileBanner="+imgFilebanner+"&imgFileBackgroundPicture="+imgFilebackgroundPicture+"&BackgroundPictureLayout="+backgroundPictureLayout;
    objMyXML = CreateObjXML();
    objMyXML.open("POST", url ,true); 
    objMyXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objMyXML.onreadystatechange = batchCustomization;
    objMyXML.send(str);               
}

//
function batchCustomization()
{
    if (objMyXML && objMyXML.readyState==4)
    {
        if (objMyXML.responseXML)
		{  
            var Str = objMyXML.responseXML.getElementsByTagName("ErrDesc");
            Str = Str[0].firstChild.data;                                   
            
            // Colors                      
            var cssRules;
	        if (document.all) 
	        {
	          cssRules = 'rules';
	        }
	        else if (document.getElementById) 
	        {
	           cssRules = 'cssRules';
	        }
	        var cssArrayNum = 3;  
	        for (var R = 0; R < document.styleSheets[cssArrayNum][cssRules].length; R++) 
	        {
	           switch(document.styleSheets[cssArrayNum][cssRules][R].selectorText)
	           {
	            case ".userForeColor":
        	        document.styleSheets[cssArrayNum][cssRules][R].style["color"] = _contentColor;
        	        break;
        	    case ".userLinkColor":
        	        document.styleSheets[cssArrayNum][cssRules][R].style["color"] = _contentColor;
        	        break;
        	    case ".userTitleForeColor":
        	        document.styleSheets[cssArrayNum][cssRules][R].style["color"] = _titleColor;
        	        break;
        	    case ".userBoxBG":
        	        document.styleSheets[cssArrayNum][cssRules][R].style["background"] = _contentBackgroundColor;
        	        break;
        	    case ".userBoxTitleBg":
        	        document.styleSheets[cssArrayNum][cssRules][R].style["background"] = _titleBackgroundColor;
        	        break;
	           }
	        }        
	        
	        // Banner
	        _banner = _banner.replace("Temp","site");	      
	        if(_banner != "")
            {
                splitStr = _banner.split('.');
                FileExt = new String(splitStr[splitStr.length-1]);
                FileExt = FileExt.toLowerCase(FileExt);
                
                if(FileExt=="swf")
                {
                    $g("BannerImg").src = IMG_SERVER_URL +  "pixel.gif";
                    $g("BannerFlash").style.display = "block";   
                    var so = new SWFObject(_banner, "FlashBanner", "1000", "150", "8", "#FFFFFF");		                    
                        so.addParam("allowScriptAccess", "never"); 		                    
                        so.write("BannerFlash");	
                }
                else
                {    
                  $g("BannerFlash").innerHTML = "";
                  $g("BannerImg").src = _banner;                                      
                }
            }
            else
            {
                $g("BannerFlash").style.display="none";                
            }      
	                    
	        // Background Picture
	        _backgroundPicture = _backgroundPicture.replace("Temp","site");
            if (_backgroundPicture.indexOf(".jpg") == -1)
            {
                _backgroundPicture = "";
            } 
            document.body.style.backgroundImage = "url(" + _backgroundPicture + ")";
            if (_backgroundPictureLayout == 0)
            {
                document.body.style.backgroundRepeat = "repeat";
                document.body.style.backgroundAttachment = "";
                document.body.style.backgroundPosition = "";
            }
            if (_backgroundPictureLayout == 1)
            {
                document.body.style.backgroundRepeat = "no-repeat";
                document.body.style.backgroundAttachment = "fixed";
                document.body.style.backgroundPosition = "Center Center";
            } 
            
	        //message Div
	        if ($g("messageDiv") != null)
            {                        
                $g("messageDiv").innerHTML = "Saved";
                $g("messageDiv").style.display='block';                
                setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
            }
        }
     }
}

// save all Customization values and Close
function saveCloseCustomization()
{       
    if (fileLodedFlag == false && fileChangedFlag == true)
    {
        $g("messageDiv").innerHTML = "Please Wait";
        $g("messageDiv").style.display='block';                
        setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
        return false;
    }
    saveCustomization();
    removeCustomAlert();
}

// add Comment to User Wall
function addWallComment(TuserId,OwnerUserId)
{        
    _SetMyUserId=TuserId;
    _SetOwnerUserId = OwnerUserId;
    //divTitle="Add comment";    
    if(TuserId == 0)
    {	    
	    logInDiv('Add comment','');
	}    
    else
    {
        url = "/Ajax/Users_WallCommentDiv.asp";
        str = "";
        objWallXML = CreateObjXML();
        objWallXML.open("POST", url ,true); 
        objWallXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
        objWallXML.onreadystatechange = batchWallCommentDiv;
        objWallXML.send(str);    
    }    	
}

function batchWallCommentDiv()
{
    if (objWallXML && objWallXML.readyState==4)
    {
        if (objWallXML.responseXML)
		{  
            var Str = objWallXML.responseXML.getElementsByTagName("Str");
            Str = Str[0].firstChild.data;            
            if(Str!="")
            {
                createCustomAlert("Add comment",Str,"605","405","","");
            }        
        }
     }
}

// Save Comment to User Page
function saveWallComment()
{
    var commentTitle = escape($g("commentTitle").value);
    var commentContent = escape($g("commentContent").value);        
    var SecCode = "";
    if ($g("SecCode")) 
    {
        SecCode = $g("SecCode").value;
        if($g("SecCode").value=="") 
        {
            $g("messageDiv").innerHTML = "Must enter security code";
            $g("messageDiv").style.display='block';        
            setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
            return false;        
        }
    }
    
    if (commentTitle == "" || commentTitle.length == 0)
    {
        $g("messageDiv").innerHTML = "please enter a title!";
        $g("messageDiv").style.display='block';        
        setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
        return false;
    }
    
    $g("saveButton").style.display='none';
    url = "/Ajax/Users_AddWallComment.asp";
    str = "pageUserId="+_SetOwnerUserId+"&commentTitle="+commentTitle+"&commentContent="+commentContent+"&SecCode="+SecCode;
    objMyXML = CreateObjXML();
    objMyXML.open("POST", url ,true); 
    objMyXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objMyXML.onreadystatechange = batchWallComment;
    objMyXML.send(str);
    bTV2N.LogAct(_ownerUserName,_ownerUserName,3,""); 
}

//
function batchWallComment()
{
    if (objMyXML && objMyXML.readyState==4)
    {
        if (objMyXML.responseXML)
		{  
            var Str = objMyXML.responseXML.getElementsByTagName("ErrDesc");
            Str = Str[0].firstChild.data;            
            //var commentsNumber = parseInt($g("CommentsNumber").value) + 1;
            //$g("CommentsNumber").value = commentsNumber;
            //$g("CommentsNumberDiv").innerHTML = commentsNumber + " Comments"; 
            if(Str!="")
            {
                var today = new Date();
                $g("saveButton").style.display='block';
                $g("SecCode_Err").innerHTML = Str;  
                $g("SecCodeDiv").innerHTML = "<img src='/Functions/SecurityCode.asp?tc=28 28 28&bg=FF FF FF&clk="+today.getDay()+today.getMonth()+today.getFullYear()+today.getHours()+today.getMinutes()+today.getSeconds()+today.getMilliseconds()+"' alt='' style='width:86;height:21' /></div>";     
                setTimeout('if ($g("SecCode_Err") != null){$g("SecCode_Err").innerHTML="";}',2000);
            }
            else
            {                                   
                removeCustomAlert();
                commentsPageing(_SetOwnerUserId,1,0);
            }
        }
     }
}

// restore the user page color to default
function restoreUserPageColors()
{
    $g("TitleColor").value = '#000000';
    $g("TitleBackgroundColor").value = '#D1D2CD';
    $g("ContentColor").value = '#000000';
    $g("ContentBackgroundColor").value = '#FFFFFF';
    
    $g("pickTitleColor").style.backgroundColor = '#000000';
    $g("pickTitleBackgroundColor").style.backgroundColor = '#D1D2CD';
    $g("pickContentColor").style.backgroundColor = '#000000';
    $g("pickContentBackgroundColor").style.backgroundColor = '#FFFFFF';
}

// set the Current user page color to default
function setCurrentUserPageColors()
{     
    $g("pickTitleColor").style.backgroundColor = _titleColor;
    $g("pickTitleBackgroundColor").style.backgroundColor = _titleBackgroundColor;
    $g("pickContentColor").style.backgroundColor = _contentColor;
    $g("pickContentBackgroundColor").style.backgroundColor = _contentBackgroundColor;
    
    $g("TitleColor").value = '#000000';
    $g("TitleColor").value = _titleColor;    
    $g("TitleBackgroundColor").value = _titleBackgroundColor;
    $g("ContentColor").value = _contentColor;
    $g("ContentBackgroundColor").value = _contentBackgroundColor;
    
}

// set the Global User Colors
function setCurrentUserGlobalColors()
{     
    //user page color
    if ($g("TitleColor") != null) _titleColor = $g("TitleColor").value;    
    if ($g("TitleBackgroundColor") != null) _titleBackgroundColor = $g("TitleBackgroundColor").value;
    if ($g("ContentColor") != null) _contentColor = $g("ContentColor").value;
    if ($g("ContentBackgroundColor") != null) _contentBackgroundColor = $g("ContentBackgroundColor").value;    
}

// set the Global User Background Picture
function setCurrentUserGlobalBackgroundPicture()
{         
    //user BackgroundPicture    
    if (_backgroundPicture.indexOf("temp") > 0 || _backgroundPicture.indexOf("Temp") > 0)
    {
        if(blogtvConfirm("Save changes ?"))
        {                 
            if ($g("TheImg") != null) _backgroundPicture = $g("TheImg").src;
            if (_backgroundPicture.indexOf(".jpg") == -1)
            {
                _backgroundPicture = "";
            }
            if ($g("BackgroundPictureLayout") != null) _backgroundPictureLayout = $g("BackgroundPictureLayout").value;
            //
            saveCustomization();
        }
        else
        {
            //_backgroundPicture = "";
            return false;
        }
    }    
}

// set the Global User Banner
function setCurrentUserGlobalBanner()
{         
    //user Banner        
    if (_banner.indexOf("temp") > 0 || _banner.indexOf("Temp") > 0)
    {
        if(blogtvConfirm("Save changes ?"))
        {   
            
            //if ($g("TheImg") != null) _banner = $g("TheImg").src;    
            //if (_banner.indexOf(".jpg") == -1)
            //{
            //    _banner = "";
            //}
            //
            saveCustomization();
        }
        else
        {
            //_banner = "";
            return false;
        }
    }
}

// Upload BackgroundPicture and Close
function uploadCloseBackgroundPicture()
{    
    if (fileLodedFlag == false && fileChangedFlag == true)
    {
        $g("messageDiv").innerHTML = "Please Wait";
        $g("messageDiv").style.display='block';                
        setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
        return false;
    }
    uploadBackgroundPicture();    
    removeCustomAlert();
}

// Upload Banner and Close
function uploadCloseBanner()
{
    if (fileLodedFlag == false && fileChangedFlag == true)
    {
        $g("messageDiv").innerHTML = "Please Wait";
        $g("messageDiv").style.display='block';                
        setTimeout('if ($g("messageDiv") != null){$g("messageDiv").style.display="none";}',2000);
        return false;
    }
    uploadBanner();
    removeCustomAlert();
}

// save UserPageColors and Close
function saveCloseUserPageColors()
{
    saveUserPageColors();
    removeCustomAlert();
}

// BackgroundPicture radio switch
function radioBackgroundPicture(switchVal)
{
    switch (switchVal)
    {
    case 0:
      $g("divImg").style.display="none";
      $g("divLayout").style.display="none";
      $g("TheImg").src = '';
      _backgroundPicture = "";      
      //$g("divBackgroundNone").checked=true;
      //$g("divBackgroundPicture").checked=false;
      break;
    case 1:      
      $g("divImg").style.display="block";
      if(_backgroundPicture != "")
      {
          $g("TheImg").src = _backgroundPicture;
      }
      else
      {
          $g("TheImg").style.display="none";
      }
      
      $g("divLayout").style.display="block";      
      //$g("divBackgroundNone").checked=false;
      //$g("divBackgroundPicture").checked=true;
      break;
    default:
      document.write("ERROR!");
    }
}

// Banner radio switch
function radioBanner(switchVal)
{
    switch (switchVal)
    {
    case 0:      
      $g("divImg").style.display="none";
      $g("TheImg").src = '';
      _banner = "";
      //$g("divBackgroundNone").checked=true;
      //$g("divBackgroundPicture").checked=false;
      break;
    case 1:      
      $g("divImg").style.display="block";
      if(_banner != "")
      {
        splitStr = _banner.split('.');
        FileExt = new String(splitStr[splitStr.length-1]);
        FileExt = FileExt.toLowerCase(FileExt);
        
        if(FileExt=="swf")
        {
            $g("TheImg").style.display = "none";   
            $g("TheFlashBanner").style.display = "block";   
            var so = new SWFObject(_banner, "FlashBanner", "450", "96", "8", "#FFFFFF");		                    
                so.addParam("allowScriptAccess", "never"); 		                    
                so.write("TheFlashBanner");	                
            
        }
        else
        {    
          
          $g("TheImg").src = _banner;
          $g("TheImg").style.display = "block";   
          $g("TheFlashBanner").style.display = "none";   
            
        }
      }
      else
      {
          $g("TheImg").style.display="none";          
      }      
      //$g("divBackgroundNone").checked=false;
      //$g("divBackgroundPicture").checked=true;
      break;
    default:
      document.write("ERROR!");
    }    
}

//
function validhex(mystring)
{
    var validchars="1234567890ABCDEF";
    var txtlen = mystring.length;
    var usrerr=0;
    if (txtlen != 6) 
    {
        usrerr = 1;
    }
    for (count = 0; count<=6; count++)
    {
        var digit = mystring.charAt(count).toUpperCase();
        if (validchars.indexOf(digit) == -1)
        {
            usrerr=1;
        }
    }
    if (usrerr !=0) 
    {
        //return("The value you entered is not correct");
        return false;
    }
    else
    {
        //return("ok");
        return true;
    }
}

// Tabs switch
function switchTab(switchVal)
{    
    switch (switchVal)
    {
    case 1:            
      if(_backgroundPicture != "")
      {
          radioBackgroundPicture(1);
      }
      else
      {
          radioBackgroundPicture(0);
      }      
      break;
    case 2:            
      if(_banner != "")
      {
          radioBanner(1);
      }
      else
      {
          radioBanner(0);
      }      
      break;
    default:
      document.write("ERROR!");
    }
}
//Language Change/////////////////////////
function ShowLanguageManu(iAct)
{
    var obj = $g("LangDiv");
    
    if (iAct){
        obj.style.display = "block";
        STO = setTimeout('ShowLanguageManu(false)',3000);
    }else{
        obj.style.display = "none";
        clearTimeout(STO);
    }    
}


function ChangeLangDmain(lang,iAct)
{
    url = "/Ajax/Language_ChangeLanguage.asp";
    str = "Lang="+lang+"&iAct="+iAct;
    objLangXML = CreateObjXML();
    objLangXML.open("POST", url ,true); 
    objLangXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objLangXML.onreadystatechange = batchChangeLang;
    objLangXML.send(str);
}

function batchChangeLang()
{
   if (objLangXML && objLangXML.readyState==4)
   {
        if (objLangXML.responseXML)
		{  
            var Str = objLangXML.responseXML.getElementsByTagName("Str");
            Str = Str[0].firstChild.data;
            var BackUrl = objLangXML.responseXML.getElementsByTagName("BackUrl");
            BackUrl = BackUrl[0].firstChild.data;          
            if(Str=="True") window.location.href = BackUrl;      
        }
    }
}
//===
function logInDiv(title,backUrl)
{   
    LogInDiv()
    return;
    aInnerHtml = GetDivInnerHTML(16);    
    _ShowInnerDiv = false;
    _onDivCloseRefresh = false;    
    createCustomAlert("",aInnerHtml,"762","252","#D7D7D7","#FFFFFF");
    $g("divUserName").focus();
}

function thisMovie(movieName)
{   
    try
    {  
        var isIE = navigator.appName.indexOf("Microsoft") != -1;
        return (isIE) ? window[movieName] : document[movieName];
    }
    catch(e){    
    return false;}
}