document.domain="hollywood.com";


//variables for Hitbox AJAX 
var hbxPagename="";
var hbxContentCategory="";
//variable to switch between hollywood login & facebook login divs
var _Facebook;
var showLinkingScreen; //used in pluckcustom.js & login pop up
var xmlHttp;
var is_ie = (navigator.userAgent.indexOf('MSIE') >= 0) ? 1 : 0; 
var is_ie5 = (navigator.appVersion.indexOf("MSIE 5.5")!=-1) ? 1 : 0; 
var is_opera = ((navigator.userAgent.indexOf("Opera6")!=-1)||(navigator.userAgent.indexOf("Opera/6")!=-1)) ? 1 : 0; 
//netscape, safari, mozilla behave the same??? 
var is_netscape = (navigator.userAgent.indexOf('Netscape') >= 0) ? 1 : 0; 
var _searchDefaultText = "Search Movies + Celebrities + TV Shows";

var _popUpExt1;
var _popUpExt2;
var _blssExt;

var RefreshAds_type;
var arrAdvt =new Array(); 
var ResetParentURL; 

function fnAdvertisement(spanClientId,position)
{
  this.SpanClientID=spanClientId ;
  this.Position=position; 
}

function isFacebook()
{
    return _Facebook;
}

// XMLHttp send GET request 
function xmlHttp_Get(xmlhttp, url) 
{ 	
	xmlhttp.open('GET', url, true); 	
    xmlhttp.send(null); 
} 

// Generate the object required for the AJAX call
function GetXmlHttpObject(handler) 
{ 
	var objXmlHttp = null;    //Holds the local xmlHTTP object instance 

    //Depending on the browser, try to create the xmlHttp object 
    if (is_ie){ 
		//The object to create depends on version of IE 
        //If it isn't ie5, then default to the Msxml2.XMLHTTP object 
        var strObjName = (is_ie5) ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP'; 
             
        //Attempt to create the object 
        try{ 
			objXmlHttp = new ActiveXObject(strObjName); 
            objXmlHttp.onreadystatechange = handler; 
        } 
        catch(e){ 
        //Object creation errored 
			alert('IE detected, but object could not be created. Verify that active scripting and activeX controls are enabled'); 
            return; 
        } 
	} 
    else if (is_opera){ 
		//Opera has some issues with xmlHttp object functionality 
		alert('Opera detected. The page may not behave as expected.'); 
        return; 
    } 
    else{ 
		// Mozilla | Netscape | Safari 
        objXmlHttp = new XMLHttpRequest(); 
        objXmlHttp.onload = handler; 
        objXmlHttp.onerror = handler; 
	} 
         
    //Return the instantiated object 
    return objXmlHttp; 
} 


//START: This method is used by "UC_FS_UniversalLogin" to refresh the parent page afer login
function RefreshParent(pParentUrl)
{
	document.domain="hollywood.com";
	if(pParentUrl)
	{
		top.window.location.href = pParentUrl
	}
	else
	{
		var str=parent.window.location.toString() ;
		var strArr=str.split("/");
		var popped = strArr.pop();
		var strFinal= strArr.join("/");
		var lastElemArr=popped.split("#");
		if(lastElemArr.length>0)
		{
			strFinal=strFinal+"/"+lastElemArr[0];
		}
		// ResetParentURL is set from Photo flipbook page as AJAX call is made
		if(parent.window.ResetParentURL) { strFinal=parent.window.ResetParentURL; } 
		self.parent.document.location.href=strFinal;
		var is_Safari = (navigator.userAgent.indexOf('Safari') >= 0) ? 1 : 0; 
		if(is_Safari==1)
		{
		    if(parent.window.ResetParentURL) { self.parent.document.location.href=parent.window.ResetParentURL; }
		    else{ self.parent.document.location.reload(true); }
		}
	}
}


//START: IE7 QA Defect, Right rail alignment issue, Rel-46, Swapnil k 09-08-2006
var detectwidth_cntr = 0;
function detectWidth(browser)
{
 return false;
}


function SetTopNavTab() 
{ 

	var arrayTabNames = new Array();
	//SunilG - Added for redesign 06/03/2008 - Start
	var arrayhtmlid = new Array();
	var arraybottomNames = new Array();

	arrayTabNames[0] = 'celebstab';
	arrayTabNames[1] = 'moviestab';
	arrayTabNames[2] = 'boxofficetab';	
	arrayTabNames[3] = 'trailerstab'; 
	arrayTabNames[4] = 'tvtab';
	arrayTabNames[5] = 'photostab';		
	arrayTabNames[6] = 'dvdtab';
	arrayTabNames[7] = 'fantab';	
	
		
	arraybottomNames[0] =  'celebstab_bottom';
	arraybottomNames[1] =  'moviestab_bottom';
	arraybottomNames[2] =  'boxofficetab_bottom';
	arraybottomNames[3] =  'trailerstab_bottom';
	arraybottomNames[4] =  'tvtab_bottom';
	arraybottomNames[5] =  'photosstab_bottom';
	arraybottomNames[6] =  'dvdtab_bottom';
	arraybottomNames[7] =  'fantab_bottom';
			
	arrayhtmlid[0] = 5;  //'celebs';
	arrayhtmlid[1] = 1;  //'movies';
	arrayhtmlid[2] = 18; //'boxoffice';
	arrayhtmlid[3] = 9;  //'trailers';
	arrayhtmlid[4] = 2;  //'tv'
	arrayhtmlid[5] = 15; //'photos';
	arrayhtmlid[6] = 3;  //'dvd'
	arrayhtmlid[7] = 14; //'fantab';
	
	//SunilG - Added for redesign 06/03/2008 - End
	
	var Tab;
	var bottomtab;
	var HtmlPageID;
	var TabPos=0;
	
	for(var iCounter=0;iCounter<arrayTabNames.length;iCounter++)
	{
		HtmlPageID = document.getElementById("Section" + arrayhtmlid[iCounter]);
		
		if(HtmlPageID == null)
		{
			continue;
		}
		else
		{
			Tab = document.getElementById(arrayTabNames[iCounter]);
   		    bottomtab = document.getElementById(arraybottomNames[iCounter]);
   		    TabPos = iCounter;
		}
		break;
	
	}			
	
    if(Tab!=null)
    {
		if(TabPos == 1 )// If its Movies tab
			{
				var TabAttribute = Tab.getAttribute("class");
				
				if(TabAttribute==null)//IE will return null as it does not recognize getAttribute("class")
				{
					Tab.setAttribute("className","navselLeft");
					if (bottomtab != null)
					{
						bottomtab.setAttribute("className","footerNavSel");
					}
				}
				else //for other browsers 
				{
					Tab.setAttribute("class","navselLeft");
					if (bottomtab != null)
					{
						bottomtab.setAttribute("class","footerNavSel");
					}
				}
			}
		else if(TabPos == 7 )// If its fan tab
			{
				var TabAttribute = Tab.getAttribute("class");
				
				if(TabAttribute==null)//IE will return null as it does not recognize getAttribute("class")
				{
					Tab.setAttribute("className","navselRight");
					if (bottomtab != null)
					{
						bottomtab.setAttribute("className","footerNavSel");
					}
				}
				else //for other browsers 
				{
					Tab.setAttribute("class","navselRight");
					if (bottomtab != null)
					{
						bottomtab.setAttribute("class","footerNavSel");
					}
				}
			}
		else
			{
				var TabAttribute = Tab.getAttribute("class");

				if(TabAttribute==null)//IE will return null as it does not recognize getAttribute("class")
				{
					Tab.setAttribute("className","navsel");
					if(bottomtab !=null)
					{
					bottomtab.setAttribute("className","footerNavSel");
					}
					
				}
				else //for other browsers 
				{
					Tab.setAttribute("class","navsel");
					if(bottomtab !=null)
					{
						bottomtab.setAttribute("class","footerNavSel");
					}	
				}
			}
	} 
			
}
//Search page code START
//Function to check if enter key was pressed in the search text boxes
function SubmitSearch(e,defaultButton) 
{  
	if (e.keyCode == 13)
	{
		e.cancelBubble = true;
		e.returnValue = false;
		zipSubmit(); 
	}	
}
//1715
//Function to check if enter key was pressed in the footer zip text box
function SubmitSearchFooter(e,defaultButton) 
{  
	if (e.keyCode == 13)
	{
		e.cancelBubble = true;
		e.returnValue = false;
		zipSubmitFooter(); 
	}	
}
//DFI-00793-for Mozilla
function SubmitSearchMain(e, defaultButton) 
{
	if (e.keyCode == 13)
	{
		//e.cancelBubble = true;
		//e.returnValue = false;	
		StartSearching();
		if(is_ie)		
		{
			e.cancelBubble = true;
			e.returnValue = false;
		}
		else
		{
			e.preventDefault();
		}
		return false;
	}	
}

//Call to Search page after comparing the TextBox and AutoCompleteBox
function loadsearchpage(searchText)
{   
    var Param_q = searchText;    
    var Param_e = '';
    
    //If the search text is default text then pass empty string for'q' parameter    
    if(searchText == 'undefined')
    {
        Param_q = '';
    }
    else if(searchText == _searchDefaultText.toLowerCase())
    {
        Param_q = '';
    }
    else
    {
        var objRegEx = /\(((tv\s\-\s\d{4})|(tv)|(\d{4}))\)$/;
        arrMatch = objRegEx.exec(searchText);    
        if(arrMatch != null && arrMatch.length > 0)
        {        
	        Param_q = searchText.replace(objRegEx, "").replace(/^\s+|\s+$/g, '');	 	    
	        Param_e = arrMatch[0];
	    }
    	
	    //TO handle & and other special characters
	    Param_q = encodeURIComponent(Param_q);
	    Param_e = encodeURIComponent(Param_e);
    }
    var searchurl = "/search.aspx?q=" + Param_q + "&e=" + Param_e;
    window.open(searchurl,"_self");
	
	/*	Please uncomment below code and comment above code to implement SLI Search	*/	
	/*
	var searchvalue = document.getElementById('<%= tbSearch.ClientID%>').value;
	var QS ="?p=Q&ts=v2&w=" + searchvalue;
	var searchurl = 'http://search.hollywood.com/search/' + QS
	window.open(searchurl,"_self");
	*/
}

//After pressing tab or enter button in AutoComplete Box
function AutoCompleteSelection(sender, e)
{    
    StartSearching();
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

//Start part of code
var arrDropDown = new Array();
	var ArrDropdownCount = 0; 
    function hideDiv(event)
    {   
		if (window.event) {
            current = this;
            related = window.event.toElement;
          }
          else {
            current = event.currentTarget;
            related = event.relatedTarget;
          }            
         
          if (current != related && !contains(current, related))
          {				        
            var t=setTimeout("hideTheMenu(current);",500)
           
           for(var arrcount=0;arrcount<arrDropDown.length;arrcount++)
           {                   					
				arrDropDown[arrcount].style.display = 'block';
		    }
          }
    }
    function hideTheMenu(current)
    {
		current.style.display = "none"
    }
    function contains(a, b) {
      // Return true if node a contains node b.
      while (b.parentNode)
        if ((b = b.parentNode) == a)
          return true;
      return false;
    }
    
    function showDiv(id)
    {       
		document.getElementById(id).style.display = 'block';
		var a=id;					
		var is_ie6 = (navigator.appVersion.indexOf("MSIE 6.0")!=-1) ? 1 : 0; 
		
		if (is_ie6=='1') 
		{
		    var Dropdown = document.getElementsByTagName("select");						
		    var Dropdown_style = "";			  
		    for (var DropdownCount=0;DropdownCount<Dropdown.length; DropdownCount++)
		    {			
		        Dropdown_style = Dropdown[DropdownCount].style;			
		        
				if(Dropdown_style.visibility == "visible" || Dropdown_style.display == "block")
				{ 
				    arrDropDown[DropdownCount] = Dropdown[DropdownCount];
				    Dropdown[DropdownCount].style.display = 'none';   
				}
				else if(Dropdown_style.visibility == "" || Dropdown_style.display == "")
			    {  					  
				    arrDropDown[DropdownCount] = Dropdown[DropdownCount];
				    Dropdown[DropdownCount].style.display = 'none';
			    }
			    else if(Dropdown_style.visibility == "hidden" || Dropdown_style.display == "none")
			    {  				  
				   
			    }	
		    }
		}		
    }
    
    function init()
    {
		//called from uc_searchcontrolfooter.ascx
        if(document.addEventListener)
			{            
				document.getElementById("div1").addEventListener("mouseout", hideDiv, false);
				//document.getElementById("div2").addEventListener("mouseout", hideDiv, false);
			}
        else
			{
				document.getElementById("div1").onmouseout = hideDiv;
				//document.getElementById("div2").onmouseout = hideDiv;
			}
	}
//End part of code

//Search page code END
/*************************************************************************************************	
Function Name: getPlayerScript(string)
Parameter: str (string)
This function generates the script required for playing the movies in trailer datail page						
											
**************************************************************************************************/
function getPlayerScript(str)
{
	while(str.indexOf('[object]') != -1)
	{
		
		str=str.replace('[object]','object');
	}
	while(str.indexOf('[embed]') != -1)
	{
		str=str.replace('[embed]','embed');
	}
	document.getElementById("lblPlayer").innerHTML=str;
	
}

 //Start - 06/05/08 Sunil M
//this function is used to work with radio button inside Repeater control
//It is beign used inside uc_trivia.ascx.vb

function SetUniqueRadioButton(nameregex, current)
{
	re = new RegExp(nameregex);
	for(i = 0; i < document.forms[0].elements.length; i++)
	{
		elm = document.forms[0].elements[i]
		if (elm.type == 'radio')
		{
			if (re.test(elm.name))
			{
				elm.checked = false;
			}
		}
	}
	current.checked = true;
	userSelectedAnswer=current.value;
}
		
//End - 06/05/08 Sunil M

//---------------------------- AJAX Ads Refresh Function -----------------------
function RefreshFrames() {
    var _host = document.location.host;
    try {
        if(RefreshAds_type=='sx') {
                // for sx Ads
                for(var i=0;i<arrAdvt.length;i++) {
                      var Advt=arrAdvt[i];
                      if((Advt.Position != "") && (OAS_listpos.indexOf(Advt.Position) > -1)) {
                              var SpanElement=document.getElementById(Advt.SpanClientID);
                              SpanElement.innerHTML='';
                              var ran_unrounded=Math.random()*100000;
                              var rndNum=Math.floor(ran_unrounded); 
                              //var URL=OAS_url + 'adstream_sx.ads/' + OAS_sitepage + '/1' + rndNum + '@' + Advt.Position ;
                              var URL='http://' + _host + '/IFrameAd.aspx?OASsitepage=' + OAS_sitepage + '&OASlistpos='+ Advt.Position + '&RandomNum=' + rndNum;                              
                              var width=0;
                              var height=0;
                              switch(Advt.Position) { 
                               case 'Top':
                                           width =728;
                                           height =90;
                                           break; 
                               case 'Middle':
                                           width =300;
                                           height =250;
                                           break; 
                               case 'Middle2':
                                           width =300;
                                           height =250;
                                           break;
                               case 'Right':
                                           width =160;
                                           height =600;
                                           break;
                              }
                              var iframeId="'AdFrame"+ Advt.Position+ "'";
                              SpanElement.innerHTML='<iframe id='+ iframeId + ' height='+ height + ' width='+ width + ' src="'+ URL + '" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no" onload="resize_iframe('+iframeId+');" ><\/iframe>';
                      } 
                }
        }else {
                // For mjx Ads
                var iframes = document.getElementsByTagName("iFrame");
                for (var i=0;i<iframes.length ; i++)
                {      var URL = iframes[i].src ;
                       URL = URL.toLowerCase();
                       /* checking the src of the iframe and if following condition true we will not set the source of iframe
                       1.  IE6 & 7 browser SRC=about:blank is set for Pluck Response & GSA Response and In FF it will set as Empty string SRC=''
                       2.  SRC=http://ads.adsonar.com/ for sponsor Ads
                       3.  SRC=_host is set for local/DEV/QA Env to avoid of reseting iframe source
                       */
                       if (URL.indexOf('http://sitelife.hollywood.com') < 0 && URL.indexOf('http://sitelifestage.hollywood.com') < 0  && 
                          URL.indexOf('http://www.hollywood.com') < 0 && URL.indexOf('facebook.com') < 0 && URL.indexOf('http://ads.adsonar.com/') < 0 && URL !=''
                          && URL.indexOf(_host) < 0 && URL.indexOf('about:blank') < 0 && URL.indexOf('myhollywood/login.aspx') < 0)
                       {                
                            iframes[i].src = iframes[i].src; 
                        }
                }
        }
        ReportPageView();
    }
    catch(e) {
        
    }
        
}
//-----------------------------End of AJAX Ads Refresh Function -----------------

// AC_RunActivecontent.js merged with script.js 25-08-08 - amol


//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
	
  if (src.indexOf('?') > -1)
	{
		if (src.indexOf(ext+'?') > -1)
			{
				return src;
			}
		else
			{
				 src=src.replace('?',ext+'?');
				 return src;
			}
	}
  else
	{
		if (src.indexOf(ext) > -1)
			{
				return src
			}
		else
			{
				return src + ext;
			}
	}
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
		args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}



// AC_RunActivecontent.js script end

function resize_iframe(iframeId)
{   
   	try
	{
		if(BrowserDetect.browser.indexOf("Firefox") != -1 || BrowserDetect.browser.indexOf("Explorer") != -1)
		{ 
		    if(iframeId=='AdFrameTop') {
			    document.getElementById(iframeId).height =  parseInt(document.getElementById(iframeId).contentWindow.document.body.scrollHeight);			
			    document.getElementById(iframeId).width =  parseInt(document.getElementById(iframeId).contentWindow.document.body.scrollWidth);
			}
			else {
                document.getElementById(iframeId).height =  parseInt(document.getElementById(iframeId).contentWindow.document.body.scrollHeight) + 5;			
			    document.getElementById(iframeId).width =  parseInt(document.getElementById(iframeId).contentWindow.document.body.scrollWidth) + 1;			
			}
		}
		else
		{
			document.getElementById(iframeId).height =  document.getElementById(iframeId).contentWindow.document.body.scrollHeight;
			document.getElementById(iframeId).width =  document.getElementById(iframeId).contentWindow.document.body.scrollWidth;
		}
	}
	catch(ex)
	{
		//alert(ex);
	}
}

//----------------------------------------- Browser Detection- Start ---------------------------------------//
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();

//----------------------------------------- Browser Detection- End ---------------------------------------//


//-----------------------------------------Login Page and login Popup function - start--------------------------------//

	function SpaceBar(e)
	{
		try
		{
			if(e)
			{
				if(BrowserDetect.browser.indexOf("Explorer") != -1)
				{
					if(e.keyCode == 32)
					{
						e.keyCode = 13;
					}	
				}
			}
		}
		catch(err)
		{}
	}
		//This function hides the login div and opens the forgot password div
	function displayPopupLoginForgotPwdDiv()
	{
	  try
		{
			divLoginId.style.display="none"
			divForgotPasswordId.style.display="block";
			SetLoginFocus();
		}
	catch(err)
		{
			//alert(err.description);
		}
		
	}
	
	function SetLoginFocus()
	{
		try
		{
			if(divLoginId.style.display != "none")
			{
				if(txtUsernameId)
				{
					txtUsernameId.focus();
				}	
			}
			if(divForgotPasswordId.style.display == "block")
			{
				if(txtEmailId)
					txtEmailId.focus();
			}
		}
		catch(err)
		{}	
	}
	
	function DisplayLodingImage(pType)
	{
		var divLoding = null;
		if(pType == 'Login')
		{
			divLoding = document.getElementById("loginLoading");
		}
		if(pType == 'ForgotPassword')
		{
			divLoding = document.getElementById("ForgotPwdLoading");
		}	
		if(divLoding)
		{
			//divLoding.style.visibility = "visible";
			divLoding.className = "tac";
		}
	}
	
		
var loginIFrame;
var loginLink;

function assignSrc(frmSource)
{   
    //set the variable to show hollywood login & not facebook login
    if((frmSource == 'CommentPage') || (frmSource == 'Header') )
    {
        _Facebook = true;        
    }
    else
    {
        _Facebook = false;
    }
    
    if(frmSource == 'CommentPage')
    {
        FbComments = true;
    }
              
    loginIFrame.setAttribute("src","/MyHollywood/Login.aspx");              
    loginIFrame.setAttribute("width","490");          
    loginIFrame.setAttribute("height","0");
           
    if(frmSource)
    {
        var modalId = _popUpExt1;
        var AddModal = $find(modalId);
        if(AddModal)
        {
            AddModal.show(); 
        }         
        else
        {
            modalId = _popUpExt2;
            AddModal = $find(modalId);
            if(AddModal)
            {
                AddModal.show();         
            }
        }              
    }
 }

function frameLoaded()
{ 
    var ele = document.getElementById('loginLoading');
    ele.style.display="none"; 
    loginIFrame.setAttribute("height","350");   
    
}

function hidePopUp()
{   
    var modalId = _popUpExt1;
    var AddModal = $find(modalId);
    if(AddModal)
    {
        AddModal.hide();
    }
    else
    {
        modalId = _popUpExt2;
        AddModal = $find(modalId);
        //alert(AddModal);
        if(AddModal)
        {
            AddModal.hide();         
        }
    }      
    var ele = document.getElementById('loginLoading');
    ele.style.display="block";    
}

function enableSignIn()
{    
	if(loginLink != null)
	{
      	 var t = loginLink.attributes.getNamedItem("class");  	
	     t.nodeValue="";
    	 loginLink.attributes.removeNamedItem("class"); 
    	 
    	 var ele = document.getElementById('anchorfConnect');
    	 ele.className = ''; 
	}  
	
}

function enableLogin()
  {
    var ele = document.getElementById('lnklogin1');
    if(ele != null)
    {
        var t = ele.attributes.getNamedItem("class");  	
        t.nodeValue="";
	    ele.attributes.removeNamedItem("class"); 
        ele.setAttribute("class","pl05 signin");
    }    
  }
  
//-----------------------------------------Login Page and login Popup function - end--------------------------------//

//-----------------------------------------BLSS Popup function - Start--------------------------------//

var blssIFrame;
function assignBLSSSrc(blssSource)
{       
    blssIFrame.setAttribute("src",blssSource);              
    blssIFrame.setAttribute("width","280");          
    blssIFrame.setAttribute("height","0");   
}

function blssFrameLoaded()
{    
    var ele = document.getElementById('blssLoading');
    ele.style.display="none"; 
    
    blssIFrame.setAttribute("height","147"); 
}

function hideBlssPopUp()
{
    var AddModal = $find(_blssExt);
    if(AddModal)
    {
        AddModal.hide();
    }  
    var ele = document.getElementById('blssLoading');
    ele.style.display="block";   
}
//-----------------------------------------BLSS Popup function - End--------------------------------//

//---------------------------------------- Start - addLoadListener function  --------------------------------//

function addLoadListener(fn) 
	{ 
		var browserName=navigator.appName; 
		if (typeof window.addEventListener != 'undefined') 
		{ 
			window.addEventListener('load', fn, false); 
		} 
		else if (typeof document.addEventListener != 'undefined') 
		{ 
			document.addEventListener('load', fn, false); 
		}	
		else if (browserName=="Microsoft Internet Explorer")
			{
				if (typeof window.attachEvent != 'undefined') 
				{ 
					window.attachEvent('onload', fn); 
				}
		}		
		else 
		{ 
			var oldfn = window.onload; 
			if (typeof window.onload != 'function') 
			{ 
				window.onload = fn; 
			} 
			else 
			{ 
				window.onload = function() 
				{ 
				oldfn(); 
				fn(); 
				}; 
			} 
		} 
	}	


//----------------------------------------- End - addLoadListener function ---------------------------------//

//Start: Intialize Video SiteCatalyst
function IntilaizeSiteCatalystParam(Content_ID, Content_Title)
{    
    try
    {
        var _Prop1, _Prop2, _Prop3, Heir, CtrlCategory, Category;
        _Prop1 = 'video';
                
        CtrlCategory = document.getElementById("ctl00_ContentPlaceHolder1_UC_Trailer_FlashBlob1_hidCategory");        
        if (CtrlCategory == null)
        {   CtrlCategory = document.getElementById("ctl00_ContentPlaceHolder1_UC_HDTrailer_FlashBlob1_hidCategory");}

        if (CtrlCategory == null)
        {   Category = 'trailers';}
        else
        {   Category = CtrlCategory.value.toLowerCase();}
       
        switch(Category)
        {
            case 'premieres':
                _Prop2 = Category;
                break;
            case 'interviews':
                _Prop2 = Category;
                break;
            case 'movie clips':
                _Prop2 = Category;
                break;
            case 'trailers':
                _Prop2 = Category;
                break;
            case 'tv clips':
                _Prop2 = Category;
                break;
            case 'hd movie clips':
                _Prop2 = 'hd';
                break;
            case 'hd spotlight':
                _Prop2 = 'hd';
                break;
            case 'hd trailers':
                _Prop2 = 'hd';
                break;
            case 'events':
                _Prop2 = 'events and awards';                
                break;
            default:
                _Prop2 = 'trailers';                
        }    
        
        if(Content_ID != '' || Content_Title != '')
        {
            Content_ID= Trim(Content_ID);
            Content_Title = Content_Title.toLowerCase();
            Content_Title =  Content_Title.replace(/<[^>]*|\s>/g, " ");
            Content_Title =  Content_Title.replace(/[^0-9a-zA-Z_\s]/g, "_");
            Content_Title =  Content_Title.replace("  ", " ");
            Content_Title = Trim(Content_Title);
                      
            _Prop3 = '(' + Content_ID + ') ' + Content_Title;
            if(_Prop3.length >= 255)
            {   
                _Prop3 = _Prop3.substring(0, 255)
            }
            
            Heir = _Prop1 + ':' + _Prop2 + ':' + _Prop2 + ':' + _Prop3;
            
            if(Heir.length >= 255)
            {                   
                Heir = Heir.substring(0, 255)
            }
        }
        else
        {   _Prop3 = 'content is not selected';
            Heir = _Prop1 + ':' + _Prop2 + ':' + _Prop2 + ':content is not selected';
        }      
        
        vars = new Object();
        vars.prop1 = _Prop1;
        vars.prop2 = _Prop2;
        vars.prop3 = _Prop2;
        vars.prop4 = _Prop3;        
        vars.hier1 = Heir;
        vars.pageName = Heir.replace(/:/g, "/");        
    }
    catch(err)
    {       
        vars = new Object();
        vars.prop1 = "video";
        vars.prop2 = "home";
        vars.prop3 = "";
        vars.prop4 = "";
        vars.hier1 = "video:home";
        vars.pageName = "video/home";
    }
}

//End: Intialize Video SiteCatalyst
function Trim(str){
    var str1 = str.replace(/^\s\s*/, ''),
        ws = /\s/,
        i = str1.length;
    while (ws.test(str1.charAt(--i)));
    return str1.slice(0, i + 1);
}

function ReportPageView()
{
    //Start sitecatalyst
    if(typeof( vars ) == "undefined")
    {            
        s.t();
    }
    else
    {
        s.t(vars);
    }
    //End sitecatalyst
    
    //Hitbox
	 _hbPageView(hbxPagename,hbxContentCategory);  

    //Start quanCast
    _qacct="p-ef1y0A8erBLUc";
    _qoptions = {qacct:"p-ef1y0A8erBLUc", media:"webpage", event:"refresh" };
    quantserve();
    //End quanCast
    
    
    //Start ComScore
     COMSCORE.beacon({c1:2,c2:3002265,c3:"",c4:"",c5:"",c6:"",c15:""});
    //End ComScore
}


/*  START OF SLDIER CONTROL CODE  */
/* 
this prototype has been referenced from site http://www.downloadjavascripts.com/Slide_Show_Auto.aspx 
*/
var SliderArrary_HP = new Array();
var Temp;
var ContentArray = new Array();
var ContentFound = false;
var UControlName='';

function fnContent(UCName,content_id,Imgcontent_id,url,title) {
    this.UCName=UCName;
	this.ContentId = content_id; 
	this.ImgContentId = Imgcontent_id; 
	this.URL =url; 
	this.Title=title;
}

function BuildContent(UCName,content_id,Imgcontent_id,url,title) {    
    var cont_id;
	var objContent;
	var objContentNew;
	ContentFound=false;
    //check if ContentID has any content    
	if(ContentArray.length>0) {
		for(i=0;i<ContentArray.length;i++) {
		    objContent = ContentArray[i];
			cont_id = objContent.ContentId;			
			//If the content_id exists
			if(content_id == cont_id) {	
				//set the flag to true
				ContentFound = true;				
				//Create the fnContent object 
				objContentNew = new fnContent(UCName,content_id,Imgcontent_id,url,title);
				//Update the ContentArray instance with the above created new object
				ContentArray[i] = objContentNew;
		    }
		}
		if(ContentFound == false) //This ContentId does not exist
		{
		    //Create the fnContent object & push it to ContentArray
		    var objContent = new fnContent(UCName,content_id,Imgcontent_id,url,title)
		    ContentArray.push(objContent);
		}
	}else //this is the first initialization for Object
	{
		//Create the fnContent object & push it to ContentArray
		var objContent = new fnContent(UCName,content_id,Imgcontent_id,url,title)
		ContentArray.push(objContent);
	}
}

function BuildArrays() {
    //debugger;
    UControlName ='';
    if(ContentArray.length>0) {
        for(i=0;i<ContentArray.length;i++) {
            objContent = ContentArray[i];
			UCName = objContent.UCName;
			if(UControlName =='') {
	            UControlName=UCName;
	            Temp = new Array();
	            Temp.push(objContent);
	            SliderArrary_HP.push(Temp);	
	        }
	        else if(UControlName != UCName) {
	            Temp = new Array();
	            Temp.push(objContent);
	            SliderArrary_HP.push(Temp);	
	            UControlName=UCName;	        	                
	        }						
			else if(UControlName == UCName) {
			        Temp.push(objContent);
			}
		}		
    }
}


function SliderClass(funcname){
    var auto = false;
    var autodelay = 5;
    var title;
    var imgext = '.jpg';
	var bxs,bxe,fxs,fxe,ys,ye,ta,ia,ie,st,ss,ft,fs,xp,yp,ci,t,tar,tarl,slideby,ta1,tar1,tarl1,t1;	

	ie=document.all?true:false;
	st=3; ss=40; ft=10; fs=5; xp,yp=0,slideby=255;
	return{
		init:function(thumb_id){
		        ta=document.getElementById(thumb_id); 
	            t=ta.getElementsByTagName('li'); 
			    ys=this.toppos(ta); ye=ys+ta.offsetHeight;
			    len=t.length;tar=[];
			    for(i=0;i<len;i++){
				    var id=t[i].value; 
				    tar[i]=id;
				    t[i].onmouseover = new Function(funcname + ".getFocus('"+id+"')");
				    t[i].onmouseout = new Function(funcname + ".lostFocus('"+id+"')");				
			    }
			    tarl=tar.length;
			    var gallerytitle=document.getElementById("gallerytitle");
		        if(gallerytitle !=null){
		            gallerytitle.innerHTML ='Click image to view gallery';
		            document.getElementById("title_pc").innerHTML = "";
		        }
		        var gallerytitle=document.getElementById("gallerytitle1");
		        if(gallerytitle !=null){
		            gallerytitle.innerHTML ='Click image to view Fan Sites';       
		        }
		},
		scrl:function(d,funcname){
			clearInterval(ta.timer);
			//debugger;
			var iscalled =false;
			var l=0;
			var lioff=t[tarl-1].offsetLeft;	
			var obj = eval(this);
			var left=ta.style.left.replace('px','');
			left = Math.abs(left);
			if(d==-1 && left!=0){
			    l=(left - slideby);		
			    iscalled =true;			    
			}else if(d==-1 && left ==0){
			    l=(slideby*3);			   
			    iscalled =true;
			}else if(d==1 && (left + slideby)<=lioff){
			    l=(left + slideby);
			    iscalled =true;
			}else if(d==1 && (left + slideby)>lioff && parseInt((left +slideby) - lioff) >5){ 
			    l=0;
			    iscalled =true;
			}else if(d==1 && (left + slideby)>lioff && parseInt((left +slideby) - lioff)==5){ 
			    l=(left + slideby);
			    iscalled =true;
			}
			//called the mv function
			if(iscalled ==true) {
			    ta.timer=setInterval(function(){obj.mv(d,l)},st);
			}    
		},
		mv:function(d,l){
		    var slideno;
			ta.style.left=ta.style.left||'0px';
			var left=ta.style.left.replace('px','');
			if(d==1){
				if(l-Math.abs(left)<=ss){
					this.cncl(ta.id); ta.style.left='-'+l+'px';
					slideno = parseInt(l/slideby);
					this.loadImages(slideno);
				}else{ta.style.left=left-ss+'px'}
			}else{
				if(Math.abs(left)-l<=ss || Math.abs(left)-l==0){
					this.cncl(ta.id); ta.style.left=-l+'px';
					slideno = parseInt(l/slideby);
					this.loadImages(slideno);
				}else{ta.style.left=parseInt(left)+ss+'px'}
			}
		},
		cncl:function(){clearTimeout(ta.timer)},
		
		lim:function(funcname){
			var taw,taa,len; taw=ta.parentNode.offsetWidth; taa=taw/4; 
			bxs=leftpos(ta); bxe=bxs+taa; fxe=bxs+taw; fxs=fxe-taa;
		},
		pos:function(e,funcname){
			if(e==-1) {
			    this.scrl(-1,funcname);
			}else if(e==1){
			    this.scrl(1,funcname);
			}
		},
		leftpos:function(t){
			var l=0;
			if(t.offsetParent){
				while(1){l+=t.offsetLeft; if(!t.offsetParent){break}; t=t.offsetParent}
			}else if(t.x){l+=t.x}
			return l;
		},
		toppos:function(t){
			var p=0;
			if(t.offsetParent){
				while(1){p+=t.offsetTop; if(!t.offsetParent){break}; t=t.offsetParent}
			}else if(t.y){p+=t.y}
			return p;
		},
		getFocus:function(id) {
		    var img=document.getElementById("id_"+id);
		    if(img !=null) {
		        img.className="PhotoSel_HP";
		    }
		    if(img.childNodes[0].childNodes[0].title !=null) {
		        title = img.childNodes[0].childNodes[0].title;
		        img.childNodes[0].childNodes[0].title="";
		    }  
		    if(title.indexOf('(') != -1) {  
		        var gallerytitle=document.getElementById("gallerytitle");
		        if(gallerytitle !=null){
		            var pc=title.split('(');
		            gallerytitle.innerHTML =pc[0];		       
		            if(id!=0) { document.getElementById("title_pc").innerHTML = "("+ pc[1]; }
		        }
		    }
		    else {
		        var gallerytitle=document.getElementById("gallerytitle1");
		        if(gallerytitle !=null){
		            //var pc=title.split('(');
		            gallerytitle.innerHTML =title;		       
		           // document.getElementById("title_pc").innerHTML = "("+ pc[1];
		        }
		    }
		    
		},
		lostFocus:function(id) {
		    var img=document.getElementById("id_"+id);
		    if(img !=null) {
		        img.className="";
		    }
		    if(img.childNodes[0].childNodes[0].title !=null) {
		       img.childNodes[0].childNodes[0].title=title;
		    }
		   	var gallerytitle=document.getElementById("gallerytitle");
		    if(gallerytitle !=null){
		        gallerytitle.innerHTML ='Click image to view gallery';
		        document.getElementById("title_pc").innerHTML = "";
		    }
		    var gallerytitle=document.getElementById("gallerytitle1");
		    if(gallerytitle !=null){
		            gallerytitle.innerHTML ='Click image to view Fan Sites';       
		    }
		    
		},
		loadImages:function(slideno){
		    var range;
		    var UC_Array;
		        switch(slideno)
					{
						case 0:
						    range=""; 
						    break;
						case 1:
						    range="0,1,2";
						    break;
						case 2:
						    range="3,4,5";
						    break;
						case 3:
						    range ="6";
					}
					switch(funcname)
					{
					    case "slideShow1":
					        UC_Array = SliderArrary_HP[0];
					        break;
					    case "slideShow2":
					        UC_Array = SliderArrary_HP[1];
					        break;
					}	
					var list = range.split(',');
					var li_id=UC_Array[list[0]];
					if(li_id !=null) {
					    var LIEle = document.getElementById("id_"+li_id.ContentId);
					    if(LIEle !=null) {
					        if(LIEle.childNodes[0].childNodes[0] ==null) {
					            for(i=0;i<list.length;i++) {
					                var li_id=UC_Array[list[i]];
					                var LIEle = document.getElementById("id_"+li_id.ContentId);
					                if(LIEle !=null) {
					                    var imageP= document.createElement('img');				
					                    if(UC_Array[list[i]].ContentId =='0' ||UC_Array[list[i]].ContentId =='1') {	            
					                        imageP.src= site_path + UC_Array[list[i]].ImgContentId + '.jpg';					
					                    }else { 
					                        imageP.src= thumb_path + UC_Array[list[i]].ImgContentId + '.jpg';					                         
					                    }    
					                    imageP.className ="bo1 boc00";
					                    imageP.title =UC_Array[list[i]].Title;					                    
					                    //LIEle.onmouseover = new Function(funcname + ".getFocus('"+UC_Array[list[i]].ContentId+"')");
				                        //LIEle.onmouseout = new Function(funcname + ".lostFocus('"+UC_Array[list[i]].ContentId+"')");		
					                    LIEle.childNodes[0].appendChild(imageP);
					                }    
					            }
					        }
					    }
					}    
		}
	};
}
//window.onload=function(){BuildArrays();};
addLoadListener(BuildArrays);


/*  END OF SLDIER CONTROL CODE  */
