$(document).ready(function() { var errorMessages = {}; //SEO fix $('h1.home').html('AMBITION2015'); $('.sf-menu').superfish({autoArrows: false, animation: {height:'show'}, speed: 'fast', dropShadows: false}); $("select#lang").selectBox().change(function(){handleLanguageChange()}); }); $('ul#main_nav li').live('mouseenter', function() { $(this).addClass('hover'); }); $('ul#main_nav li').live('mouseleave', function() { $(this).removeClass('hover'); }); // wrap as a jQuery plugin and pass jQuery in to our anoymous function (function ($) { $.fn.glow = function (options) { return this.each(function (i) { // cache the copy of jQuery(this) - the start image var $$ = $(this); var target = $$.css('background-image'); $$.wrapInner(""); $$.find(':first-child').css({'background-image': target, opacity: 0}); $$.hover( function() { $(this).stop().children("span").animate({opacity: 1}, 750); }, function() { $(this).stop().children("span").stop().animate({opacity: 0}, 750); } ); }); }; })(jQuery); // note that this uses the .bind('load') on the window object, rather than $(document).ready() // because .ready() fires before the images have loaded, but we need to fire *after* because // our code relies on the dimensions of the images already in place. $(window).bind('load', function () { $('a.cta').glow(); }); function adjustleftcol(){ //Adjust nav column var int_height = $("div#content_detail").height(); $("div#left_nav").height(int_height+'px'); } function showcopy(ele){ $("div.copy").each( function hide(){ var id=$(this).attr('id'); var display = $(this).css('display'); if(display=='block'){ $(this).css('display','none'); } $("div#"+ele).css('display','block'); } ); } function setactive(id){ if(document.getElementById(id)){ var theElement = document.getElementById(id); if(theElement.className == "trigger"){ theElement.className = "trigger active"; theElement.innerHTML = "> "+theElement.innerHTML; }else{ theElement.className = "trigger"; var str = theElement.innerHTML.substr(5); theElement.innerHTML = str; } } } function shownhide(id){ if(document.getElementById(id)){ var theElement = document.getElementById(id); if(theElement.style.display == "none"){ theElement.style.display = "block"; }else{ theElement.style.display = "none"; } } } function filternews(int_year){ if(int_year=="0"){ window.location.href='/news-and-media/news-releases.php'; }else{ window.location.href='/news-and-media/news-releases.php?year='+int_year; } } function filtermedia(int_year){ if(int_year=="0"){ window.location.href='/news-and-media/carlson-in-the-media.php'; }else{ window.location.href='/news-and-media/carlson-in-the-media.php?year='+int_year; } } function at_show_aux(parent, child) { var p = document.getElementById(parent); var c = document.getElementById(child ); var top = (c["at_position"] == "y") ? p.offsetHeight : 0; var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0; for (; p; p = p.offsetParent) { top += p.offsetTop; left += p.offsetLeft; } c.style.position = "absolute"; c.style.left = "50%"; c.style.width = '952px'; c.style.margin = '0 0 0 -476px'; c.style.top = '112px'; c.style.visibility = "visible"; c.style.zIndex = "999"; } // ***** at_show ***** function at_show() { $("#shadow").show(); $("#shadow").stop().animate({ "opacity": "0.8" }, "fast", "swing"); var p = document.getElementById(this["at_parent"]); var c = document.getElementById(this["at_child" ]); //fnc_parent_hover_over(this["at_parent"]); at_show_aux(p.id, c.id); clearTimeout(c["at_timeout"]); } // ***** at_hide ***** function at_hide() { $("#shadow").stop().animate({ "opacity": "0" }, "fast", function() { $("#shadow").hide(); }); var p = document.getElementById(this["at_parent"]); var c = document.getElementById(this["at_child" ]); //fnc_parent_hover_out(this["at_parent"]); c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 0); } // ***** at_click ***** function at_click() { var p = document.getElementById(this["at_parent"]); var c = document.getElementById(this["at_child" ]); if (c.style.visibility != "visible") at_show_aux(p.id, c.id); else c.style.visibility = "hidden"; return false; } // ***** at_attach ***** // PARAMETERS: // parent - id of the parent html element // child - id of the child html element that should be droped down // showtype - "click" = drop down child html element on mouse click // "hover" = drop down child html element on mouse over // position - "x" = display the child html element to the right // "y" = display the child html element below // cursor - omit to use default cursor or specify CSS cursor name function at_attach(parent, child, showtype, position, cursor) { var p = document.getElementById(parent); var c = document.getElementById(child); p["at_parent"] = p.id; c["at_parent"] = p.id; p["at_child"] = c.id; c["at_child"] = c.id; p["at_position"] = position; c["at_position"] = position; c.style.position = "absolute"; c.style.visibility = "hidden"; if (cursor != undefined) p.style.cursor = cursor; switch (showtype) { case "click": p.onclick = at_click; p.onmouseout = at_hide; c.onmouseover = at_show; c.onmouseout = at_hide; break; case "hover": p.onmouseover = at_show; p.onmouseout = at_hide; c.onmouseover = at_show; c.onmouseout = at_hide; break; } } function verify_email(str) { var at="@"; var dot="."; var lat=str.indexOf(at); var lstr=str.length; var ldot=str.indexOf(dot); if (str.indexOf(at)==-1){return false;} if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) {return false;} if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) {return false;} if (str.indexOf(at,(lat+1))!=-1) {return false;} if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) {return false;} if (str.indexOf(dot,(lat+2))==-1) {return false;} if (str.indexOf(" ")!=-1) {return false;} return true; } function form_input_is_numeric(input){ if(input==""){ bln=false; }else{ bln=!isNaN(input);} return bln; } function checkform(form_id){ var bln_valid=true; var str_message=''; if(form_id=="frm_media_enquiry"){ if(document.getElementById('name').value==""){ bln_valid=false; str_message=str_message+errorMessages['nameRequired']; } if(document.getElementById('pub_name').value==""){ bln_valid=false; str_message=str_message+errorMessages['newsOutletRequired']; } if(document.getElementById('email').value==""){ bln_valid=false; str_message=str_message+errorMessages['emailRequired']; } if(document.getElementById('request').value==""){ bln_valid=false; str_message=str_message+errorMessages['descriptionRequired']; } }else if(form_id=="frm_email_alerts"){ if(document.getElementById('name').value==""){ bln_valid=false; str_message=str_message+errorMessages['nameRequired']; } if(!verify_email(document.getElementById('email').value)){ bln_valid=false; str_message=str_message+errorMessages['emailRequired']; } if(document.getElementById('pub_name').value==""){ bln_valid=false; str_message=str_message+errorMessages['publicationRequired']; } if (!($('#brand1').attr('checked')) && !($('#brand2').attr('checked')) && !($('#brand3').attr('checked')) && !($('#brand4').attr('checked')) && !($('#brand5').attr('checked')) && !($('#brand6').attr('checked'))) { bln_valid=false; str_message=str_message+"You must select an alert option\n"; } }else if(form_id=="frm_media_acccommodation"){ if(document.getElementById('name').value==""){ bln_valid=false; str_message=str_message+errorMessages['nameRequired']; } if(document.getElementById('pub_name').value==""){ bln_valid=false; str_message=str_message+errorMessages['publicationRequired']; } if(document.getElementById('email').value==""){ bln_valid=false; str_message=str_message+errorMessages['emailRequired']; } if(document.getElementById('assignment').value==""){ bln_valid=false; var mediaInformation = false; } if(document.getElementById('dat_pub_date').value=="-"){ bln_valid=false; var mediaInformation = false; } if(document.getElementById('party').value==""){ bln_valid=false; var mediaInformation = false; } if(document.getElementById('hotel_benefit').value==""){ bln_valid=false; var mediaInformation = false; } if(document.getElementById('editor').value==""){ bln_valid=false; var mediaInformation = false; } if(document.getElementById('e_phone').value==""){ bln_valid=false; var mediaInformation = false; } if(mediaInformation==false){ var mediaInformation = false; str_message=str_message+errorMessages['mediaInformationRequired']; } if(document.getElementById('loc_city').value==""){ bln_valid=false; var location = false; } if(document.getElementById('state_id2').value=="0"){ bln_valid=false; var location = false; } if(document.getElementById('country_id2').value=="0"){ bln_valid=false; var location = false; } if(document.getElementById('h_name').value==""){ bln_valid=false; var location = false; } if(document.getElementById('dat_arr_date').value=="0"){ bln_valid=false; var location = false; } if(document.getElementById('dat_dep_date').value=="0"){ bln_valid=false; var location = false; } if(location==false){ var mediaInformation = false; str_message=str_message+errorMessages['locationAndDatesRequired']; } } if(!bln_valid){ alert(str_message); return false; }else{ document.getElementById(form_id).submit(); } } function exportEmail(pId) { $(':input','#adminEmailSummaryForm').attr('checked',false); $("#checkbox"+pId).attr("checked", true).val(pId); $("#adminEmailSummaryForm").submit(); } function exportSelectedEmail() { $("#adminEmailSummaryForm [name=selected]").is(":checked") ? $("#adminEmailSummaryForm").submit() : alert("No row is selected."); } function exportAllEmail() { $(':input','#adminEmailSummaryForm').attr('checked',false); $("#adminEmailSummaryForm").submit(); } function submitSiteSearch() { $("#siteSearchForm").submit(); } function clearValue(pId) { $("#"+pId).val(""); } function handleLanguageChange() { var lLanguageOptions = document.localeform.lang.options; var lSelectedOption = lLanguageOptions[lLanguageOptions.selectedIndex]; document.localeform.submit(); }