﻿function createLeftNavigationBg()
{if(document.getElementById("content")!=null)
{var contentDom=document.getElementById("content");var sidebarDom=document.getElementById("subnav-parent");if(sidebarDom!=null)
sidebarDom.style.height=(contentDom.offsetHeight)+"px";}}
$(function(){$('.search-text').bind('keyup',function(e){if(e.keyCode==40){$('#header_listbox ul li a').css('background','none');if($('.highlight_prog_search').length<1){$('#header_listbox ul li:first').addClass('highlight_prog_search');}else{if($('.highlight_prog_search').next().length<1){$('.highlight_prog_search').removeClass('highlight_prog_search');$('#header_listbox ul li:first').addClass('highlight_prog_search');}else{var itsNext=$('.highlight_prog_search').removeClass('highlight_prog_search').next().addClass('highlight_prog_search');}}
return;}
else if(e.keyCode==38){$('#header_listbox ul li a').css('background','none');if($('.highlight_prog_search').length<1){$('#header_listbox ul li:last').addClass('highlight_prog_search');}else{if($('.highlight_prog_search').prev().length<1){$('.highlight_prog_search').removeClass('highlight_prog_search');$('#header_listbox ul li:last').addClass('highlight_prog_search');}else{var itsPrev=$('.highlight_prog_search').removeClass('highlight_prog_search').prev().addClass('highlight_prog_search');}}
return;}
else if(e.keyCode==13){$('.highlight_prog_search').trigger('click');return;}
else if($.trim(this.value)==''){$('#header_listbox').hide();return;}
var sVal=$(this).val();var finalHTML='';$('#header_listbox').val('');if(sVal==""||sVal.length<4)
{$('#header_listbox').hide();}
else
{
if ($('#span_search_prog').hasClass('active') == false)    
    return;
var searchString=sVal.split(" ");for(var i=0;i<prog_title.length;i++)
{for(var j=0;j<searchString.length;j++)
{var programURL=prog_title[i].split(',')[1];var programTitle=prog_title[i].split(',')[0];if((programTitle.toLowerCase().indexOf(searchString[j].toLowerCase())!=-1)&&(searchString[j].replace(" ","")!="")&&(finalHTML.indexOf(programTitle)==-1))
{if(finalHTML=='')
{finalHTML="<ul onmouseover='javascript:return dispDiv(this);' id='program_search_result'><li id='search_res_li_"+i+"_"+j+"' onMouseOut='javascript:return removeBackground(this);' onmouseover='javascript:return dispDiv(this);'><a href='"+programURL+"' >"+programTitle+"</a></li>";}
else
{finalHTML+="<li id='search_res_li_"+i+"_"+j+"' onMouseOut='javascript:return removeBackground(this);' onmouseover='javascript:return dispDiv(this);'><a href='"+programURL+"' >"+programTitle+"</a></li>";}}}}}
if(finalHTML!='')
{$('#header_listbox').html(finalHTML+"</ul>");$('#header_listbox').removeClass('divHide');$('#header_listbox').css('display','block');$('#header_listbox').addClass('divShow');}});});function dispDiv(ele)
{if(ele.id!='program_search_result')
{var childItems=document.getElementById('program_search_result').childNodes;for(i=0;i<childItems.length;i++){document.getElementById(childItems[i].id).className=document.getElementById(childItems[i].id).className.replace(/(?:^|\s)highlight_prog_search(?!\S)/,'');}
ele.className='highlight_prog_search';}
document.getElementById('header_listbox').style.display='block';}
function timedLayer()
{setTimeout("hideDiv()",5000);}
function hideDiv()
{document.getElementById('header_listbox').style.display='none';document.getElementById('header_listbox').innerHTML = '';}
function changeBackground(ele)
{ele.className='highlight_prog_search';document.getElementById('header_listbox').style.display='block';}
function removeBackground(ele)
{if(ele.className!='')
ele.className=ele.className.replace(/(?:^|\s)highlight_prog_search(?!\S)/,'');}
$(document).ready(function(){var btnProgramSearch=$("input[id$=btnSearch]");$(".btn").click(function(){var searchQ="";var flag;var sProgram='';$(".program_search").find(".even").find(".dll").each(function(){var current=$(this);$(current)[0].selectedIndex;if((current)[0].selectedIndex>0)
searchQ+="#"+$(current).val();});if(searchQ!="")
{var args=searchQ.split('#');for(var i=0;i<prog_title.length;i++)
{for(var j=0;j<args.length;j++)
{if(prog_title[i].split(',')[2].toUpperCase().search(args[j].toUpperCase())!=-1)
flag=true;else{flag=false;break;}}
if(flag==true)
{sProgram+="<a href='"+prog_title[i].split(',')[1]+"' >"+prog_title[i].split(',')[0]+"</a><br />";}}
$(".program_search").find(".odd").find(".hs_temp").each(function(){var current=$(this);var hfHidden=document.getElementById(current.attr('id'));hfHidden.value=sProgram;});}});});function searchTerm(){var val=document.getElementById('inpSearch').value;window.parent.location="http://sheridan.summon.serialssolutions.com/search?s.q="+val;return false;}
function open_win(url_add)
{window.open(url_add,'welcome','width=300,height=200,menubar=yes,status=yes, location=yes,toolbar=yes,scrollbars=yes');}
function viewSearchoptions()
{var isVisible=document.getElementById('searchOption').offsetWidth>0||document.getElementById('searchOption').offsetHeight>0;if(isVisible==false)
document.getElementById('searchOption').style.display='block';else
document.getElementById('searchOption').style.display='none';return false;}
function ClearSelection(lb)
{l.innerHTML='';}
function imageShow(divId){var imgM=document.getElementById('imgMain');if(divId=='1'){imgM.src='~/media/Health%20Services/rotator2_e_bulletin.ashx';}
else if(divId=='2'){imgM.src='~/media/Health%20Services/rotator1_nutrition_tips.ashx';}
else if(divId=='3'){imgM.src='~/media/Health%20Services/rotator3_meet_our_staff.ashx';}
return false;}
function openWin(pageURL)
{window.open(pageURL);}
function viewPathway(relTag)
{var itemCnt=document.getElementById('success-story').childNodes.length;var itemId="";for(var i=0;i<=itemCnt-1;i++)
{itemId=document.getElementById('success-story').childNodes.item(i).id;if(itemId.toUpperCase()==relTag.toUpperCase())
document.getElementById(relTag).style.display='block';else
document.getElementById(itemId).style.display='none';}
return false;}
$(document).ready(function(){$('#header_listbox ul li a').mouseover(function(){var current=$(this).parent();$('#header_listbox ul li').each(function(){$(this).removeClass('highlight_prog_search');});$(current).addClass('highlight_prog_search');return false;});$("#info-for dl dd a").click(function(){alert('hi');});var querystring=window.location.search.substring(1);if(querystring!="")
{var qaVariable=querystring.split('&');if(qaVariable[0].split('=')[0]=='iframe_src'&&qaVariable[0].split('=')[1]=='y')
{var ifSrc="http://cfprod.sheridaninstitute.ca/coned/infosession_reg/index.cfm?EVENT_ID="+qaVariable[1].split('=')[1];$("#theiframe").attr('src',ifSrc);}}
if($(".hs_leftContent").length>0)
{$(".highlight_box").addClass("highlight_box_white");$(".onefull").parents('div.sub_padding clearfix').removeClass("sub_padding clearfix");}
if($(".remove_grey_bg").length>0)
{$(".highlight_box").addClass("highlight_box_white");}});function searchRes()
{var searchQ;var flag;var sProgram='';if(searchQ!="")
searchQ="";var ddlAI=document.getElementById('<%= ddlAI.ClientID %>');if(ddlAI.selectedIndex>0)
searchQ+="#"+ddlAI.options[ddlAI.selectedIndex].value;var ddlCampus=document.getElementById('<%= ddlCampus.ClientID %>');if(ddlCampus.selectedIndex>0)
searchQ+="#"+ddlCampus.options[ddlCampus.selectedIndex].value;var ddlFaculty=document.getElementById('<%= ddlFaculty.ClientID %>');if(ddlFaculty.selectedIndex>0)
searchQ+="#"+ddlFaculty.options[ddlFaculty.selectedIndex].value;var ddl_Dip_Degree=document.getElementById('<%= ddl_Dip_Degree.ClientID %>');if(ddl_Dip_Degree.selectedIndex>0)
searchQ+="#"+ddl_Dip_Degree.options[ddl_Dip_Degree.selectedIndex].value;var args=searchQ.split('#');for(var i=0;i<prog_title.length;i++)
{for(var j=0;j<args.length;j++)
{if(prog_title[i].split(',')[2].toUpperCase().search(args[j].toUpperCase())!=-1)
{flag=true;}
else
{flag=false;break;}}
if(flag==true)
{sProgram+="<a href='"+prog_title[i].split(',')[1]+"' >"+prog_title[i].split(',')[0]+"</a><br />";}}
if(sProgram!="")
{var hfHidden=document.getElementById('<%= hfHidden.ClientID %>');hfHidden.value=sProgram;}}
$(document).ready(function(){var strToc="";var strToc2="";var totalItem=$(".hs_temp").length/2;$(".hs_temp").each(function(i){var current=$(this);if(i<totalItem)
strToc+="<li><a href='#"+current.attr('id')+"'>"+current.next().html()+"</a></li>";else
strToc2+="<li><a href='#"+current.attr('id')+"'>"+current.next().html()+"</a></li>";});$("#toc").append("<ul>"+strToc+"</ul>");$("#tocBottom").append("<ul>"+strToc+"</ul>");$("#toc2").append("<ul>"+strToc2+"</ul>");$("#tocBottom2").append("<ul>"+strToc2+"</ul>");if(document.getElementById("content")!=null)
{var contentDom=document.getElementById("content");var sidebarDom=document.getElementById("subnav-parent");if(sidebarDom != null){sidebarDom.style.height=(contentDom.offsetHeight)+"px";}}});$(document).ready(function()
{$("#tbTitle").keypress(function(e){c=e.which?e.which:e.keyCode;if(c==13)
{var code=$("#tbTitle").val();code=jQuery.trim(code);var str="http://sculptor.sheridanc.on.ca/webapp/wcs/stores/servlet/CatalogSearchResultView?storeId=10051&catalogId=10051&langId=-1&pageSize=12&beginIndex=0&sType=SimpleSearch&resultType=2&searchTerm="+code;str=jQuery.trim(str);window.open(str);$("#tbTitle").val('');return false;}});});
