// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function resizeText(multiplier) {
  if (document.body.style.fontSize == "") {
    document.body.style.fontSize = "1.0em";
  }
  document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (multiplier * 0.2) + "em";
}

function show_tooltip(e, id) {
	$(id).style.position = "fixed";
	$(id).style.left = (e.clientX + 5) + "px";
	$(id).style.top = (e.clientY + 5) + "px";
	$(id).style.display = "block";
	$(id).style.zIndex = 5000;
}

function hide_tooltip(e, id) {
	$(id).style.display = "none";
}

function switch_account(where){
    if(where == "new_account"){
        $$('.exist_account').each(function(elem){ elem.toggle();}); $$('.new_account').each(function(elem){ elem.toggle();});
        $('user_session_email').value = ''
        $('user_session_password').value = ''
    }else{
        $$('.exist_account').each(function(elem){ elem.toggle();}); $$('.new_account').each(function(elem){ elem.toggle();});
        $('user_email').value = ''
        $('user_password').value = ''
        $('user_password_confirmation').value = ''
        $('user_phone').value = ''
        $$('.selectAll').each(function(e){
            if(e.type == "checkbox"){
                e.checked = false;
            }
        });
        $$('.multi_select').each(function(e){ e.checked = false; });
        $$('.multiSelect').each(function(e){ e.value = '-'; });
        
        $('user_pro').checked = false;
        $('user_web').value = ''
        $('user_logo').value = ''
        $('logo_pro').hide();
    }
    
}

function hide_or_show_go_button(action, ad_id){
    if(action == 'show'){
        //$('btn_submit').src = "/images/layout/go_button_white.gif";
        //$('btn_submit').disabled = false;
        $('my_button_go').innerHTML = "<input type='image' id='btn_submit' src='/images/layout/go_button_white.gif'>"
    }else{
        //$('btn_submit').src = "/images/layout/go_button_white.gif";
        //$('btn_submit').disabled = true;
        $('my_button_go').innerHTML = "<a href='#' class='button_white' onclick=\"if($F('my_city') == ''){$('where').className='red'; $('where').scrollTo(); return false; }; new Ajax.Request('/cities/cities_list/"+ ad_id +"', {asynchronous:true, evalScripts:true, parameters:'my_city=' + $F('my_city')  + '&amp;country=' + $F('ad_country') + '&amp;authenticity_token=' + encodeURIComponent('2LLWL9cg1qxqPWZBqNuQ4lSvUK8xSLyfwljkc2VEr2I=')}); return false;\"></a>"
        $('choosen_data').innerHTML = ''
        $('city').value = ''
    }
}

function show_mini_spinner() {
    $('mini_spinner').toggle();
}
