$(document).ready( function() { //Function to get query string: to use: "var p = gup('param');" //From: http://www.netlobo.com/url_query_string_javascript.html function gup( name ) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return results[1]; } function RePopulateDropDown(obj, firstOptionText, optionArray, optionValuePrefix, delay) { obj.find('option').remove(); obj.append(''); setTimeout(function() { obj.find('option').remove(); if( firstOptionText ) { obj.append(''); } $.each( optionArray, function( index, val ) { if( val ) obj.append(''); } ) }, delay ); } // MasterPage - Menu $('#li1').mouseover(function() { $('#u1').css({display: 'block'}); }); $('#li1').mouseout(function() { $('#u1').css({display: 'none'}); }); $('#li2').mouseover(function() { $('#u2').css({display: 'block'}); }); $('#li2').mouseout(function() { $('#u2').css({display: 'none'}); }); $('#li3').mouseover(function() { $('#u3').css({display: 'block'}); }); $('#li3').mouseout(function() { $('#u3').css({display: 'none'}); }); $('#li4').mouseover(function() { $('#u4').css({display: 'block'}); }); $('#li4').mouseout(function() { $('#u4').css({display: 'none'}); }); // MasterPageHome $('#ebSI').mouseover(function() { this.src='/images/mm_web_home_pan_sol_tit_on.png'; }); $('#ebSI').mouseout(function() { this.src='/images/mm_web_home_pan_sol_tit_off.png'; }); $('#ebII').mouseover(function() { this.src='/images/mm_web_home_pan_ind_tit_on.png'; }); $('#ebII').mouseout(function() { this.src='/images/mm_web_home_pan_ind_tit_off.png'; }); // EXPLORER BAR - INDUSTRIES/SITES var ex_in = $('#explore_industry'); var ex_si = $('#explore_site'); var ex_in_items = ''; var allInd = new Array(); var AddIndustry = function(id, name, url) { allInd[id] = { name:name, url:url, sites:new Array()}; ex_in_items += ''; } var AddSite = function(indId, id, name, url) { allInd[indId].sites[id] = { name:name, url:url }; } ex_in.change(function() { var select = allInd[ex_in.val()].sites.length > 0 ? 'Select a Site' : 'No Site Available'; RePopulateDropDown(ex_si, select, allInd[ex_in.val()].sites, '', 500); }); AddIndustry('2', 'Automotive', 'http://www.mediamotive.com.au/industries/automotive/'); AddIndustry('1', 'Bikes', 'http://www.mediamotive.com.au/industries/bikes/'); AddIndustry('3', 'Marine', 'http://www.mediamotive.com.au/industries/marine/'); AddIndustry('18', 'Real Estate', 'http://www.mediamotive.com.au/industries/real-estate/'); AddIndustry('16', 'Caravans', 'http://www.mediamotive.com.au/industries/caravans/'); AddIndustry('20', 'Trucks', 'http://www.mediamotive.com.au/industries/trucks/'); AddIndustry('4', 'Construction & Industry', 'http://www.mediamotive.com.au/industries/construction-industry/'); AddIndustry('17', 'Farming & Forestry', 'http://www.mediamotive.com.au/industries/farming-forestry/'); AddIndustry('19', 'Classifieds', 'http://www.mediamotive.com.au/industries/classifieds/'); AddSite('2', '1', 'carsales.com.au', 'http://www.mediamotive.com.au/sites/carsalescomau.aspx'); AddSite('2', '24', 'CarPoint.com.au', 'http://www.mediamotive.com.au/sites/carpointcomau.aspx'); AddSite('2', '5', 'RedBook.com.au', 'http://www.mediamotive.com.au/sites/redbookcomau.aspx'); AddSite('2', '26', 'Discountnewcars.com.au', 'http://www.mediamotive.com.au/sites/discountnewcarscomau.aspx'); AddSite('2', '3', 'Discountusedcars.com.au', 'http://www.mediamotive.com.au/sites/discountusedcarscomau.aspx'); AddSite('2', '28', 'Prestigenewcars.com.au', 'http://www.mediamotive.com.au/sites/prestigenewcarscomau.aspx'); AddSite('2', '41', 'greencarsales.com.au', 'http://www.mediamotive.com.au/sites/greencarsalescomau.aspx'); AddSite('2', '44', 'Yahoo carsales', 'http://www.mediamotive.com.au/sites/yahoo-carsales.aspx'); AddSite('2', '40', 'uniquecarsales.com.au', 'http://www.mediamotive.com.au/sites/uniquecarsalescomau.aspx'); AddSite('1', '5', 'RedBook.com.au', 'http://www.mediamotive.com.au/sites/redbookcomau.aspx'); AddSite('1', '2', 'bikesales.com.au', 'http://www.mediamotive.com.au/sites/bikesalescomau.aspx'); AddSite('1', '23', 'BikePoint.com.au', 'http://www.mediamotive.com.au/sites/bikepointcomau.aspx'); AddSite('1', '25', 'Discountnewbikes.com.au', 'http://www.mediamotive.com.au/sites/discountnewbikescomau.aspx'); AddSite('3', '5', 'RedBook.com.au', 'http://www.mediamotive.com.au/sites/redbookcomau.aspx'); AddSite('3', '31', 'boatsales.com.au', 'http://www.mediamotive.com.au/sites/boatsalescomau.aspx'); AddSite('3', '30', 'BoatPoint.com.au', 'http://www.mediamotive.com.au/sites/boatpointcomau.aspx'); AddSite('18', '27', 'homesales.com.au', 'http://www.mediamotive.com.au/sites/homesalescomau.aspx'); AddSite('16', '36', 'RVPoint.com.au', 'http://www.mediamotive.com.au/sites/rvpointcomau.aspx'); AddSite('20', '37', 'TruckHub.com.au', 'http://www.mediamotive.com.au/sites/truckhubcomau.aspx'); AddSite('4', '6', 'ConstructionHub.com.au', 'http://www.mediamotive.com.au/sites/constructionhubcomau.aspx'); AddSite('4', '35', 'MineHub.com.au', 'http://www.mediamotive.com.au/sites/minehubcomau.aspx'); AddSite('4', '32', 'FactoryHub.com.au', 'http://www.mediamotive.com.au/sites/factoryhubcomau.aspx'); AddSite('17', '34', 'HorsePoint.com.au', 'http://www.mediamotive.com.au/sites/horsepointcomau.aspx'); AddSite('17', '29', 'FarmHub.com.au', 'http://www.mediamotive.com.au/sites/farmhubcomau.aspx'); AddSite('17', '33', 'ForestHub.com.au', 'http://www.mediamotive.com.au/sites/foresthubcomau.aspx'); AddSite('19', '43', 'quicksales.com.au', 'http://www.mediamotive.com.au/sites/quicksalescomau.aspx'); ex_in.append(ex_in_items); // GO $('a#iGo').bind('click', function() { if( !ex_in.val() ) alert('Please Select an Industry'); else if ( !ex_si.val() ) window.location = allInd[ex_in.val()].url; else { window.location = allInd[ex_in.val()].sites[ex_si.val()].url; } return false; }) // EXPLORER BAR - SOLUTION/PRODUCTS var ex_sol = $('#explore_solution'); var ex_pro = $('#explore_product'); var ex_sol_items = ''; var allSol = new Array(); var AddProduct = function(id, name, url) { allSol[id] = { name:name, url:url, products:new Array() }; ex_sol_items += ''; } var AddProductSolution = function(solId, id, name, url) { allSol[solId].products[id] = { name:name, url:url }; } ex_sol.change(function() { var str = allSol[ex_sol.val()].products.length > 0 ? 'Select a Product' : 'No Product Available'; RePopulateDropDown(ex_pro, str, allSol[ex_sol.val()].products, '', 500); }); AddProduct('1', 'Display Advertising', 'http://www.mediamotive.com.au/solutions/display-advertising/'); AddProduct('13', 'Category Sponsors', 'http://www.mediamotive.com.au/solutions/category-sponsors/'); AddProduct('11', 'Finance Sponsors', 'http://www.mediamotive.com.au/solutions/finance-sponsors/'); AddProduct('12', 'Insurance Sponsors', 'http://www.mediamotive.com.au/solutions/insurance-sponsors/'); AddProduct('8', 'Microsites', 'http://www.mediamotive.com.au/solutions/microsites/'); AddProduct('2', 'E-newsletter', 'http://www.mediamotive.com.au/solutions/e-newsletter/'); AddProduct('10', 'Custom Solutions', 'http://www.mediamotive.com.au/solutions/custom-solutions/'); AddProductSolution('1', '4', 'Leaderboard', 'http://www.mediamotive.com.au/products/leaderboard.aspx'); AddProductSolution('1', '3', 'MREC', 'http://www.mediamotive.com.au/products/mrec.aspx'); AddProductSolution('1', '5', 'Video MREC', 'http://www.mediamotive.com.au/products/video-mrec.aspx'); AddProductSolution('1', '2', 'Skyscraper', 'http://www.mediamotive.com.au/products/skyscraper.aspx'); AddProductSolution('1', '1', 'Banner', 'http://www.mediamotive.com.au/products/banner.aspx'); AddProductSolution('1', '18', 'Content Clips', 'http://www.mediamotive.com.au/products/content-clips.aspx'); AddProductSolution('1', '19', 'Content Clips (Large)', 'http://www.mediamotive.com.au/products/content-clips-large.aspx'); AddProductSolution('1', '9', 'Non-Standard Button', 'http://www.mediamotive.com.au/products/non-standard-button.aspx'); AddProductSolution('13', '3', 'MREC', 'http://www.mediamotive.com.au/products/mrec.aspx'); AddProductSolution('13', '2', 'Skyscraper', 'http://www.mediamotive.com.au/products/skyscraper.aspx'); AddProductSolution('13', '1', 'Banner', 'http://www.mediamotive.com.au/products/banner.aspx'); AddProductSolution('13', '9', 'Non-Standard Button', 'http://www.mediamotive.com.au/products/non-standard-button.aspx'); AddProductSolution('13', '11', 'Homepage Reskin (Left & Right Gutters)', 'http://www.mediamotive.com.au/products/homepage-reskin-left-right-gutters.aspx'); AddProductSolution('11', '4', 'Leaderboard', 'http://www.mediamotive.com.au/products/leaderboard.aspx'); AddProductSolution('11', '3', 'MREC', 'http://www.mediamotive.com.au/products/mrec.aspx'); AddProductSolution('11', '2', 'Skyscraper', 'http://www.mediamotive.com.au/products/skyscraper.aspx'); AddProductSolution('11', '1', 'Banner', 'http://www.mediamotive.com.au/products/banner.aspx'); AddProductSolution('11', '9', 'Non-Standard Button', 'http://www.mediamotive.com.au/products/non-standard-button.aspx'); AddProductSolution('12', '4', 'Leaderboard', 'http://www.mediamotive.com.au/products/leaderboard.aspx'); AddProductSolution('12', '3', 'MREC', 'http://www.mediamotive.com.au/products/mrec.aspx'); AddProductSolution('12', '2', 'Skyscraper', 'http://www.mediamotive.com.au/products/skyscraper.aspx'); AddProductSolution('12', '1', 'Banner', 'http://www.mediamotive.com.au/products/banner.aspx'); AddProductSolution('12', '9', 'Non-Standard Button', 'http://www.mediamotive.com.au/products/non-standard-button.aspx'); AddProductSolution('8', '4', 'Leaderboard', 'http://www.mediamotive.com.au/products/leaderboard.aspx'); AddProductSolution('8', '3', 'MREC', 'http://www.mediamotive.com.au/products/mrec.aspx'); AddProductSolution('8', '5', 'Video MREC', 'http://www.mediamotive.com.au/products/video-mrec.aspx'); AddProductSolution('8', '11', 'Homepage Reskin (Left & Right Gutters)', 'http://www.mediamotive.com.au/products/homepage-reskin-left-right-gutters.aspx'); AddProductSolution('2', '4', 'Leaderboard', 'http://www.mediamotive.com.au/products/leaderboard.aspx'); AddProductSolution('2', '3', 'MREC', 'http://www.mediamotive.com.au/products/mrec.aspx'); AddProductSolution('2', '19', 'Content Clips (Large)', 'http://www.mediamotive.com.au/products/content-clips-large.aspx'); AddProductSolution('10', '5', 'Video MREC', 'http://www.mediamotive.com.au/products/video-mrec.aspx'); AddProductSolution('10', '12', 'Homepage Reskin (Expandable)', 'http://www.mediamotive.com.au/products/homepage-reskin-expandable.aspx'); AddProductSolution('10', '10', 'Homepage Reskin (Right Gutter)', 'http://www.mediamotive.com.au/products/homepage-reskin-right-gutter.aspx'); AddProductSolution('10', '11', 'Homepage Reskin (Left & Right Gutters)', 'http://www.mediamotive.com.au/products/homepage-reskin-left-right-gutters.aspx'); AddProductSolution('10', '13', 'Homepage Reskin (Full Page)', 'http://www.mediamotive.com.au/products/homepage-reskin-full-page.aspx'); AddProductSolution('10', '14', 'Homepage Reskin (Page Push)', 'http://www.mediamotive.com.au/products/homepage-reskin-page-push.aspx'); ex_sol.append(ex_sol_items); // GO $('a#sGo').bind('click', function() { if( !ex_sol.val() ) alert('Please Select a Product Category'); else if ( !ex_pro.val() ) window.location = allSol[ex_sol.val()].url; else { window.location = allSol[ex_sol.val()].products[ex_pro.val()].url; } return false; }) // CASE STUDY var allCaseStudies = new Array(); var csCount = 0; var AddCaseStudy = function(id, name, description, url, icon) { allCaseStudies[id] = { Name:name, Description:description, Url:url, Icon:icon }; csCount++; } AddCaseStudy('1', 'Ad Torque', 'Targeting The Right Audience Every Time', 'http://www.mediamotive.com.au/case-studies/using-online-reaches-the-right-audience.aspx', 'Ad Torque 1.JPG'); // AddCaseStudy('2', 'Bryan Byrt', 'Investing In Online Advertising', 'http://www.mediamotive.com.au/case-studies/bryan-byrt-invests-in-dealer-display-online-advertising.aspx', 'Bryan Byrt2.JPG'); // AddCaseStudy('3', 'Trivett\'s', 'Boosting Retail Sales Through Online Awareness', 'http://www.mediamotive.com.au/case-studies/trivetts-call-to-action-boosts-retail-offer.aspx', 'Trivett.JPG'); // var nextCS = function() { currCS++; if(!allCaseStudies[currCS+'']) currCS=1; updateCS(currCS); return false; } var prevCS = function() { currCS--; if(!allCaseStudies[currCS+'']) currCS=csCount; updateCS(currCS); return false; } var updateCS = function(id) { var cs = allCaseStudies[id+'']; var icon = cs.Icon ? '/upload/HomepageIcon/' + cs.Icon : '/images/blank.gif'; $('#csCTAT').html(cs.Name); $('#csCTA2').html(cs.Description); $('#csCTAIcon').attr('src', icon); $('#csCTAIcon').css({display: cs.Icon ? 'block' : 'none'}); $('#csCTA1').attr('href', cs.Url); $('#csCTA2').attr('href', cs.Url); $('#csCTA3').attr('href', cs.Url); $('#csCTA4').attr('href', cs.Url); } $('#csNext').bind('click', nextCS); $('#csPrev').bind('click', prevCS); var rotateCS = function(delay) { nextCS(); setTimeout(function() { rotateCS(delay); }, delay ); } var currCS = 0; rotateCS(5000); // INDUSTRIES/SOLUTION var indSol = $('#indSol'); //var type = $('#type'); if( indSol /*&& type*/ ) { indSol.append(''); $.each( allInd, function( index, val ) { if( val ) indSol.append(''); } ); indSol.append(''); $.each( allSol, function( index, val ) { if( val ) indSol.append(''); } ); //pre-set values if dropdowns have been selected var ind = gup('industry'); var sol = gup('solution'); if( ind || sol ) { var t = ind ? 'i_' : 's_'; var v = ind ? ind : sol; indSol.val(t+v); } indSol.change(function() { var path = window.location.pathname; if( indSol.val() ) { var t = indSol.val().charAt(0); var id = indSol.val().substring(2); var query = t == 'i' ? '?industry=' : '?solution='; path += query + id; } window.location = path; }); /* type.change(function() { var val = type.val(); var lastIndex = val.lastIndexOf('_'); var t = val.charAt(0); var id = val.substring(2, lastIndex); var id2 = val.substring(lastIndex+1); var path = window.location.pathname; var query = t == 'i' ? '?industry=' : '?solution='; query += id2; window.location = path + query }); */ } });