﻿// JScript File

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function buyTicket(theListing, theMovie, theTime, theDate){
    theListing = theListing.replace("Theater_", "")
    theMovie = theMovie.replace("Movie_", "")        
    window.open("https://www.movietickets.com/purchase.asp?afid=toron&house_id="+ theListing + "&movie_id=" + theMovie + "&perft=" + theTime + "&perfd=" + theDate + "&language=2", "ticketWindow")
}

function showMore(theId){
    document.getElementById("topTen").style.display="none"
    document.getElementById("AllCategories").style.display="block"
    document.getElementById("AllCategoriesBtn").style.display="block"
}
function showLess(theId){   
    document.getElementById("topTen").style.display="block"
    document.getElementById("AllCategories").style.display="none"
    document.getElementById("AllCategoriesBtn").style.display="none"
    
}

//yahoo suggest starts here

var yahooquerywords = null;
var yahooquerycount = 0;

function yahoocallback(obj)
{
  var text = yahooquerywords[yahooquerycount];
  suggestwrapper = document.getElementById("yahooSuggestWrapper");
  suggestobj = document.getElementById("yahooSuggest");  
  if (suggestobj) {
    if (suggestobj.innerHTML.length > 0) {
      suggestobj.innerHTML += " ";
    }
    if (obj.ResultSet.Result) {
      text = obj.ResultSet.Result;
      suggestobj.innerHTML += "(" + text + ")";
      suggestwrapper.style.display = "inline";
    }
    suggestobj.href += text + "%20";
  }
  yahooquerycount++;
}

function yahooSeachSuggestion(query) {
  yahooquerywords = query.split(' ');
  var url = "http://search.yahooapis.com/WebSearchService/V1/spellingSuggestion?appid=vVPn8UTV34FDViolhsuVdfQgqhJc9chc7jld.br8AdxrtrUfuq3PQet20NnJz1j1NLwbLMPlmjZY6JmrHSQ-&output=json&callback=yahoocallback&query=";
  var resultobj = null;
  for (i = 0;i<yahooquerywords.length;i++) {
    document.write('<scr'+'ipt type="text/javascript" src="'+url + yahooquerywords[i]+'"></scr'+'ipt>');
  }
}

// ends yahoo suggest

/* function showTimes(theday){
    for(j=0; j<4; j++){
    
        if (document.getElementById("ctl00_ContentPlaceHolder_main_searchResults_movies_ctl0"+j+"___MovieKey___ctl00___RepeatingTemplate___ctl00___ListingByToday__"))
        {
    
    //alert("j " + j + "id" ) 
    for(i=0; i<=4; i++){
    
    dtoday ="ctl00_ContentPlaceHolder_main_searchResults_movies_ctl0"+j+"___MovieKey___ctl00___RepeatingTemplate___ctl0"+i+"___ListingByToday__"
    dtodayAddOne="ctl00_ContentPlaceHolder_main_searchResults_movies_ctl0"+j+"___MovieKey___ctl00___RepeatingTemplate___ctl0"+i+"___ListingByTodayAddOne__"
    dtodayAddTwo ="ctl00_ContentPlaceHolder_main_searchResults_movies_ctl0"+j+"___MovieKey___ctl00___RepeatingTemplate___ctl0"+i+"___ListingByTodayAddTwo__"
    dtodayAddThree="ctl00_ContentPlaceHolder_main_searchResults_movies_ctl0"+j+"___MovieKey___ctl00___RepeatingTemplate___ctl0"+i+"___ListingByTodayAddThree__" 
    
    
    
    
        if(document.getElementById(dtoday)){                    
            document.getElementById(dtoday).style.display = "none"
            
        }
        
        if(document.getElementById(dtodayAddOne)){                    
            document.getElementById(dtodayAddOne).style.display = "none"
            
        }
        
        if(document.getElementById(dtodayAddTwo)){                    
            document.getElementById(dtodayAddTwo).style.display = "none"
            
        }
        
        if(document.getElementById(dtodayAddThree)){                    
            document.getElementById(dtodayAddThree).style.display = "none"
            
        }
        
        
        if(theday == "to_day"){                               
            if(document.getElementById(dtoday)){  
                document.getElementById(dtoday).style.display = "block"                        
            }                    
         }  
         
         if(theday == "todayAddOne"){                               
            if(document.getElementById(dtodayAddOne)){  
                document.getElementById(dtodayAddOne).style.display = "block"                        
            }                    
         } 
         
         if(theday == "todayAddTwo"){                               
            if(document.getElementById(dtodayAddTwo)){                    
                document.getElementById(dtodayAddTwo).style.display = "block"                        
            }                    
         } 
         
         if(theday == "todayAddThree"){                               
            if(document.getElementById(dtodayAddThree)){                    
                document.getElementById(dtodayAddThree).style.display = "block"                        
            }                    
         }  
     }
     }
     else
        {
        //alert(document.getElementById("ctl00_ContentPlaceHolder_main_searchResults_movies_ctl0"+j+"___MovieKey___ctl00___RepeatingTemplate___ctl00___ListingByToday__"))
        //break;
        }      
    }
}*/

//// PAGE BOOKMARK FUNCTION ////
function bookmark(title,url){
if (window.sidebar) // firefox
window.sidebar.addPanel(title, url,'http://www.simcoe.com');
else if(window.opera && window.print){ // opera
var elem = document.createElement('a');
elem.setAttribute('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();
}
else if(document.all)// ie
window.external.AddFavorite(url, title);
}
