
$(function(){$('#contact_form').submit(function(){var action=$(this).attr('action');action=action.replace(/no_js/,'');$(this).attr('action',action);return true;});});

function calculate_time_zone(){var rightNow=new Date();var jan1=new Date(rightNow.getFullYear(),0,1,0,0,0,0);var june1=new Date(rightNow.getFullYear(),6,1,0,0,0,0);var temp=jan1.toGMTString();var jan2=new Date(temp.substring(0,temp.lastIndexOf(" ")-1));temp=june1.toGMTString();var june2=new Date(temp.substring(0,temp.lastIndexOf(" ")-1));var std_time_offset=(jan1-jan2)/(1000*60*60);var daylight_time_offset=(june1-june2)/(1000*60*60);var dst;if(std_time_offset==daylight_time_offset){dst="0";}else{var hemisphere=std_time_offset-daylight_time_offset;if(hemisphere>=0)
std_time_offset=daylight_time_offset;dst="1";}
return{'std_time_offset':convert_tz(std_time_offset),'dst':dst};}
function convert_tz(value){var hours=parseInt(value);value-=parseInt(value);value*=60;var mins=parseInt(value);value-=parseInt(value);value*=60;var secs=parseInt(value);var display_hours=hours;if(hours==0){display_hours="+00";}else if(hours>0){display_hours=(hours<10)?"+0"+hours:"+"+hours;}else{display_hours=(hours>-10)?"-0"+Math.abs(hours):hours;}
mins=(mins<10)?"0"+mins:mins;return display_hours+":"+mins;}
function set_tz_dropdown(element)
{if(element&&element.selectedIndex==0)
{tz_obj=calculate_time_zone();var i;for(i=0;i<element.options.length;i++){if(element.options[i].title==tz_obj.std_time_offset+","+tz_obj.dst){element.selectedIndex=i;break;}}}}
function send_tz(url){if(!url){return;}
$.post(url,calculate_time_zone());}
function set_tz_show_link_text()
{var tz_select_text=$('#time_zone :selected').text();if(tz_select_text==''){show_tz_options_container();}else{$('#tz_show_link').html(tz_select_text);}}
$(function()
{var tz_dropdown=$('#time_zone');if(tz_dropdown.length>0)
{set_tz_dropdown(tz_dropdown[0]);var tz_show_link=$('#tz_show_link');if(tz_show_link.length>0)
{set_tz_show_link_text();tz_show_link.click(function(){$('#tz_options_container').show();$('#tz_show_link_container').hide();return false;});}}
if(typeof(UPDATE_TZ)!='undefined'&&UPDATE_TZ){send_tz(BASEURL+'session/time_zone');}});
