function toggleSearch(which) {
$A($('pt1_search_element_bar').childNodes).each(function(element) {
if(element.tagName == 'DIV') {element.style.display = 'none'} })

if ($('pt1_search_'+which)) {$('pt1_search_'+which).style.display='block'}
else { $('pt1_search_content').style.display = 'block'}

$('pt1_search_element_select').style.display = 'block'
$('pt1_search_dropdown').value = which
}

function initSearch() {
var pages = [
[/\/$/, 'content'],
[/\/news/, 'content'],
[/\/results_content/, 'content'],
[/\/events/, 'events'],
[/klass=event/, 'events'],
[/klass=profile/, 'profiles'],
[/\/my_profiles/, 'profiles'],
[/\/full/, 'content'] ]

var which_search = 'content';
pages.each(function(element) {if(document.URL.search(element[0]) != -1) { which_search = element[1] }})
toggleSearch(which_search);
initMenu();
}

function toggleMenu(which) {
 $A($('pt1_main_menu').childNodes).each(function(element) {
 if(element.className == 'pt1_item_active') {element.className = 'pt1_item'}})
 $A($('pt1_sub_menu').childNodes).each(function(element) {
 if(element.className == 'pt1_menu_group') {element.style.display = 'none'}})
 $(which).className = 'pt1_item_active'
 $(which + '_group').style.display = 'block'
}
	
function initMenu() {
var pages = [
[/\/$/, 'home'],
[/\/account/, 'home'],
[/\/ad_details/, 'home'],
[/\/business.*/, 'home'],
[/\/contact_us/, 'home'],
[/\/edit_fob_profile/, 'my_content'],
[/\/edit_profile/, 'my_content'],
[/\/events/, 'community'],
[/\/feedback/, 'community'],
[/\/full_story/, 'home'],
[/\/tor*/, 'home'],
[/\/ny*/, 'home'],
[/\/afternoon_news/, 'home'],
[/\/full_local_story/, 'home'],
[/\/login/, 'home'],
[/\/my_.*/, 'home'],
[/\/news.*/, 'home'],
[/\/results_content/, 'home'],
[/\/signup/, 'home'],
[/\/welcome/, 'community']]

var which_page = 'home'
pages.each(function(element) {if(document.URL.search(element[0]) != -1) { which_page = element[1]}})
toggleMenu('main_menu_' + which_page)

$A($('pt1_main_menu').childNodes).each(function(element) {
if(element.className == 'pt1_item' || element.className == 'pt1_item_active') {
element.onmouseover = function() {toggleMenu(element.id)}}
})
}

function setRichTime(nTime){
setTimeout("closeRich('Layer1')",(nTime*1000));
}

function closeRich(szDivID){
if(document.layers){document.layers[szDivID].visibility="hide";} else
if(document.getElementById){var obj=document.getElementById(szDivID);obj.style.visibility="hidden";} else
if(document.all){document.all[szDivID].style.visibility="hidden";}
}

function land(ref, target){
if (target=="_self") {window.location=loc;} else {if (target=="_top") {top.location=loc;}
else {if (target=="_blank") {window.open(loc);} else {if (target=="_parent") {parent.location=loc;} else {parent.frames[target].location=loc;};}}}
}

function jump(menu){
ref=menu.language.options[menu.language.selectedIndex].value;
ref = ref.replace("ht'+'tp://", "ht"+"tp://");
splitc=ref.lastIndexOf("&"); target="";
if (splitc!=-1) {loc=ref.substring(0,splitc);target=ref.substring(splitc+1,1000).toLowerCase();} else {loc=ref; target="_self";};
if (ref!="") {land(loc,target);}
}

var xV1 = 40;
function stayHome(){
nV = document.body.scrollTop;$('isFloat1').style.top = xV1+nV;
}
window.onscroll=stayHome;