$(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', '44', 'Yahoo carsales', 'http://www.mediamotive.com.au/sites/yahoo-carsales.aspx'); AddSite('2', '45', 'motoring.com.au', 'http://www.mediamotive.com.au/sites/motoringcomau.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', 'caravancampingsales.com.au', 'http://www.mediamotive.com.au/sites/caravancampingsalescomau.aspx'); AddSite('20', '37', 'trucksales.com.au', 'http://www.mediamotive.com.au/sites/trucksalescomau.aspx'); AddSite('4', '6', 'constructionsales.com.au', 'http://www.mediamotive.com.au/sites/constructionsalescomau.aspx'); AddSite('4', '35', 'plantmachinerysales.com.au', 'http://www.mediamotive.com.au/sites/plantmachinerysalescomau.aspx'); AddSite('4', '29', 'farmmachinerysales.com.au', 'http://www.mediamotive.com.au/sites/farmmachinerysalescomau.aspx'); AddSite('17', '29', 'farmmachinerysales.com.au', 'http://www.mediamotive.com.au/sites/farmmachinerysalescomau.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('15', 'Mobile Advertising', 'http://www.mediamotive.com.au/solutions/mobile-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', '9', 'Non-Standard Button', 'http://www.mediamotive.com.au/products/non-standard-button.aspx'); AddProductSolution('1', '21', 'Half Page', 'http://www.mediamotive.com.au/products/half-page.aspx'); AddProductSolution('1', '28', 'Category, Lifestyle and Make Landing Page Sponsorship', 'http://www.mediamotive.com.au/products/category-lifestyle-and-make-landing-page-sponsorship.aspx'); AddProductSolution('1', '27', 'Comparison Tool', 'http://www.mediamotive.com.au/products/comparison-tool.aspx'); AddProductSolution('1', '20', '300x100 Tile', 'http://www.mediamotive.com.au/products/300x100-tile.aspx'); AddProductSolution('15', '22', 'Mobile 300x50', 'http://www.mediamotive.com.au/products/mobile-300x50.aspx'); AddProductSolution('15', '23', 'Mobile 300x36', 'http://www.mediamotive.com.au/products/mobile-300x36.aspx'); AddProductSolution('15', '24', 'iPad App Leaderboard', 'http://www.mediamotive.com.au/products/ipad-app-leaderboard.aspx'); AddProductSolution('15', '25', 'iPad App Insurance & Finance', 'http://www.mediamotive.com.au/products/ipad-app-insurance-finance.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', '9', 'Non-Standard Button', 'http://www.mediamotive.com.au/products/non-standard-button.aspx'); AddProductSolution('13', '21', 'Half Page', 'http://www.mediamotive.com.au/products/half-page.aspx'); AddProductSolution('13', '11', 'CarPoint Homepage Reskin (Left & Right Gutters)', 'http://www.mediamotive.com.au/products/carpoint-homepage-reskin-left-right-gutters.aspx'); AddProductSolution('13', '28', 'Category, Lifestyle and Make Landing Page Sponsorship', 'http://www.mediamotive.com.au/products/category-lifestyle-and-make-landing-page-sponsorship.aspx'); AddProductSolution('13', '20', '300x100 Tile', 'http://www.mediamotive.com.au/products/300x100-tile.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', '20', '300x100 Tile', 'http://www.mediamotive.com.au/products/300x100-tile.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', '20', '300x100 Tile', 'http://www.mediamotive.com.au/products/300x100-tile.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', '21', 'Half Page', 'http://www.mediamotive.com.au/products/half-page.aspx'); AddProductSolution('8', '11', 'CarPoint Homepage Reskin (Left & Right Gutters)', 'http://www.mediamotive.com.au/products/carpoint-homepage-reskin-left-right-gutters.aspx'); AddProductSolution('8', '20', '300x100 Tile', 'http://www.mediamotive.com.au/products/300x100-tile.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', '20', '300x100 Tile', 'http://www.mediamotive.com.au/products/300x100-tile.aspx'); AddProductSolution('10', '5', 'Video MREC', 'http://www.mediamotive.com.au/products/video-mrec.aspx'); AddProductSolution('10', '21', 'Half Page', 'http://www.mediamotive.com.au/products/half-page.aspx'); AddProductSolution('10', '11', 'CarPoint Homepage Reskin (Left & Right Gutters)', 'http://www.mediamotive.com.au/products/carpoint-homepage-reskin-left-right-gutters.aspx'); AddProductSolution('10', '13', 'CarPoint Homepage Reskin (Full Page)', 'http://www.mediamotive.com.au/products/carpoint-homepage-reskin-full-page.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', '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('2', '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 }); */ } });