$(function(){ jQuery.fn.center = function () { this.css("position","absolute"); this.css("top", Math.max(0, (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop()) + "px"); this.css("left", Math.max(0, (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft()) + "px"); return this; } // ENTER KEY BEGIN $(document).on( 'keydown', 'input', function(e){ if (e.keyCode == 13) { var triggerClick = $(this).attr('e'); //alert(triggerClick); //console.log( 'triggerClick: ' + triggerClick ); switch( triggerClick ) { case 'headersearch': //var s = $('#header #quick-search #search-criteria').val(); //var url = '/search.php?search-criteria=' + encodeURI(s); //window.location = url; document.forms["search-anything"].submit(); //doSearch(1); break; case 'headerlogin': //console.log( "form#login.trigger('submit')" ); //$('form#login').trigger('submit'); // not twice return true; // trigger form submit break; case 'signinlogin': // the standard login form included in all pages //console.log( "form#form-sign-in.trigger('submit')" ); //$('form#form-sign-in').trigger('submit'); // not twice return true; // trigger form submit break; case 'registerlogin': $('#register-modal-content #btnSignInTry').trigger('click'); //return true; // trigger form submit break; case 'registerother': $('#register-modal-content #btnRegisterTry').trigger('click'); //return true; // trigger form submit break; case 'searchkw': return true; break; case 'save_search': return true; break; default: //alert('Error: e value missing for ' + triggerClick); } return false; } }); // ENTER KEY END //all all tracks to project start //close $(document).on( 'click', '#btnCloseProjects', function(e) { $('#project-add-track').empty(); $('#project-add-track').addClass('gone'); }); //add all from playlist $(document).on( 'click', '.addAllPlaylistToProjectTrigger', function(e) { if( $('#project-add-track').hasClass('gone') ) { var playlist_id = $(this).attr('playlist_id'); var clickX = e.pageX; var clickY = e.pageY; var windowX = $(window).width(); //alert(clickX + ',' + clickY); //return false; $('#project-add-track').css({ position: 'absolute', top: clickY + 10, left: clickX - 525 }); $('#mx-add-comment').addClass('gone'); $('#project-add-track').removeClass('gone'); $('#project-add-track').load('/mymegatrax/my-select-project-add-playlist.php',{ 'rDom':Math.random()*99999 }, function(complete){ //alert($('#project-add-track').width()); $('#project-add-track #playlist_id').val(playlist_id); }); } else { $('#project-add-track').addClass('gone'); $('#mx-add-comment').addClass('gone'); } }); //start btnAddPlaylistToProposal $(document).on( 'click', '#btnAddPlaylistToProposal', function(e) { //dSearchId on my-singledownloader.php var sPropId = $('#project-add-track #select_proposal_id').val(); var jSearchId = $('#project-add-track #ms_track_track_id').val(); var playlist_id = $('#project-add-track #playlist_id').val(); var sPropNew = $('#project-add-track #new_proposal_name').val(); $.ajax( '/mymegatrax/my-select-proposal-insert-playlist.php', { 'method': 'POST', 'data': { 'jSearchId': jSearchId, 'sPropId': sPropId, 'sPropNew': sPropNew, 'playlist_id': playlist_id, 'rDom': Math.random()*99999 }, 'complete': function( resp ) { var dups = parseInt(resp.responseText); if( dups > 0 ) { alert( 'Duplicate: Track(s) already added to this Proposal' ); } else { alert( 'Track(s) added to Proposal' ); } $('#project-add-track').empty().addClass('gone'); } } ); }); //start btnAddPlaylistToProject $(document).on( 'click', '#btnAddPlaylistToProject', function(e) { var sProjId = $('#project-add-track #select_project_id').val(); var jSearchId = $('#project-add-track #ms_track_track_id').val(); var playlist_id = $('#project-add-track #playlist_id').val(); var sProjNew = $('#project-add-track #new_project_name').val(); //alert(playlist_id + ', ' + sProjNew); //return false; $.ajax( '/mymegatrax/my-select-project-insert-playlist.php', { 'method': 'POST', 'data': { 'jSearchId': jSearchId, 'sProjId': sProjId, 'sProjNew': sProjNew, 'playlist_id': playlist_id, 'rDom': Math.random()*99999 }, 'complete': function( resp ) { var dups = parseInt(resp.responseText); if( dups > 0 ) { alert( 'Duplicate: Track(s) already added to this Project' ); } else { alert( 'Track(s) added to Project' ); } $('#project-add-track').empty().addClass('gone'); } } ); }); $(document).on( 'click', '.addAllToProjectTrigger', function(e) { if( $('#project-add-track').hasClass('gone') ) { var cd_id = $(this).attr('cd_id'); var clickX = parseInt(e.pageX); var clickY = parseInt(e.pageY); //clickX = 30; $('#project-add-track').css({ 'width': '500px', 'position': 'absolute', 'top': clickY + 10 + 'px', 'left': clickX - 525 + 'px' }); $('#mx-add-comment').addClass('gone'); $('#project-add-track').removeClass('gone'); $('#project-add-track').load('/mymegatrax/my-select-project-add.php',{ 'rDom':Math.random()*99999 }, function(complete){ $('#project-add-track #cd_id').val(cd_id); }); } else { $('#project-add-track').addClass('gone'); $('#mx-add-comment').addClass('gone'); } }); //add all tracks to project end //addToProjectTrigger //j=ms_search_id (or not) $(document).on( 'click', '.addToProjectTrigger', function(e) { if($('#project-add-track').hasClass('gone')){ var j = $(this).attr('j'); var clickX = parseInt(e.pageX); var clickY = parseInt(e.pageY); var windowX = parseInt($(window).width()); $('#project-add-track').css({ 'width': '500px', 'position': 'absolute', top: clickY + 10 + 'px', left: clickX - 525 + 'px' }); $('#project-add-track').removeClass('gone'); $('#mx-add-comment').addClass('gone'); $('#project-add-track').load( '/mymegatrax/my-select-project-add.php',{ 'rDom': Math.random()*99999 }, function(complete) { $('#project-add-track #track_id').val(j); } ); } else { $('#project-add-track').addClass('gone'); $('#mx-add-comment').addClass('gone'); } }); //start btnAddToProject $(document).on( 'click', '#btnAddToProject', function(e) { //dSearchId on my-singledownloader.php var sProjId = $('#project-add-track #select_project_id').val(); var track_id = $('#project-add-track #track_id').val(); var cd_id = $('#project-add-track #cd_id').val(); var sProjNew = $('#project-add-track #new_project_name').val(); //alert( 'sProjId: ' + sProjId + ', track_id: ' + track_id + ', sProjNew: ' + sProjNew + ', cd_id: ' + cd_id ); //console.log( 'sProjId: ' + sProjId + ', track_id: ' + track_id + ', sProjNew: ' + sProjNew + ', cd_id: ' + cd_id ); $.ajax( '/mymegatrax/my-select-project-insert.php', { 'method': 'POST', 'data': { 'track_id': track_id, 'sProjId': sProjId, 'sProjNew': sProjNew, 'cd_id': cd_id, 'rDom': Math.random()*99999 }, 'complete': function( resp ) { var dups = parseInt(resp.responseText); if( dups > 0 ) { alert( 'Duplicate: Track(s) already added to this Project' ); } else { alert( 'Track(s) added to Project' ); } $('#project-add-track').empty().addClass('gone'); } } ); }); $(document).on( 'click', '.order_button', function(e){ // load up the license app var track_id = ( e.currentTarget.getAttribute('track_id') ? e.currentTarget.getAttribute('track_id') : 0 ); //console.log( 'order button clicked; track_id: ' + track_id ); document.location = '/license-music.php?tracks=' + track_id; }); //start mx-add-comment $(document).on( 'click', '.mxComments', function(e) { if($('#mx-add-comment').hasClass('gone')){ var cName = $(this).attr('cName'); var cValue = $(this).attr('cValue'); var mainTrackId = $(this).attr('maintrackid'); var clickX = e.pageX; var clickY = e.pageY; var windowX = $(window).width(); var windowY = $(window).height(); var pg = '/studio.php'; //console.log( 'pg: ' + pg + ', clickX: ' + clickX + ', e.pageY: ' + e.pageY + ', clickY: ' + clickY ); if(cName == 'cd_id'){ switch(pg) { case '/browse-details.php': $('#mx-add-comment').css({ position: 'absolute', top: parseInt( clickY + 17 ) + 'px', left: parseInt( clickX - 10 ) + 'px' }); break; case '/browse.php': if(clickX > 700){ // open left from click // 100-200 col1, 300-400 col2, 500-600 col3, 700-800 col4, 900-1000 col5 clickX = clickX - 420; } else if(clickX > 500 && clickX < 600){ clickX = clickX - 110; } else { // open right from click } $('#mx-add-comment').css({ position: 'absolute', top: clickY + 17 + 'px', left: clickX + 'px' }); break; case '/catalog.php': if(clickX > 700){ clickX = clickX - 420; } else if(clickX > 500 && clickX < 600){ clickX = clickX - 110; } else{ // open right from click } $('#mx-add-comment').css({ position: 'absolute', top: clickY + 17 + 'px', left: clickX + 'px' }); break; default: //clickX = 0; //alert('pg: ' + pg + ' clickX: ' + clickX + ' clickY: ' + clickY + ' windowX: ' + windowX + ' windowY: ' + windowY); } } else { switch(pg) { case '/playlists.php': //alert('pg: ' + pg + ' clickX: ' + clickX + ' clickY: ' + clickY + ' windowX: ' + windowX + ' windowY: ' + windowY); $('#mx-add-comment').css({ position: 'absolute', top: clickY + 17 + 'px', right: windowX - clickX + 'px' }); break; case '/search.php': //alert('pg: ' + pg + ' clickX: ' + clickX + ' clickY: ' + clickY + ' windowX: ' + windowX + ' windowY: ' + windowY); $('#mx-add-comment').css({ position: 'absolute', top: clickY + 10 + 'px', left: clickX - 425 + 'px' }); break; default: $('#mx-add-comment').css({ position: 'absolute', top: parseInt( clickY + 9 ) + 'px', //right: parseInt( clickX + 315 ) + 'px' left: parseInt( clickX - 415 ) + 'px' }); //console.log( 'default; clickX: ' + clickX + ', clickY+10: ' + parseInt( clickY + 10 ) + 'px' ); } } $('#project-add-track').addClass('gone'); $('#comment_text').val(''); $('#mx-add-comment').removeClass('gone'); $('#mx-add-comment').load('/mymegatrax/my-mx-comment-edit.php',{ 'cName': cName, 'cValue': cValue, 'mainTrackId': mainTrackId, 'rDom': Math.random()*99999 }, function(complete){ //$('#mx-add-comment').append('

' + cName + ' x:' + clickX + ' y:' + clickY + '

'); //$('#mx-add-comment').append('

pg: ' + pg + '
clickX: ' + clickX + ' clickY: ' + clickY + ' windowX: ' + windowX + ' windowY: ' + windowY + '

'); }); //$('#song-add-comment').html(song_id); } else { $('#project-add-track').addClass('gone'); $('#mx-add-comment').addClass('gone'); } }); $(document).on( 'click', '#notecancel', function(e) { $('#mx-add-comment').addClass('gone'); }); $(document).on( 'click', '#frmComment #btnCommentUpdate' , function(e) { var cValue = $('#frmComment #cValue').val(); $.post("/mymegatrax/my-mx-comment-update.php", $('#frmComment').serialize(),function(data){ $('#project-add-track').addClass('gone'); $('#mx-add-comment').addClass('gone'); }); }); $(document).on( 'click', '#frmComment #btnCommentInsert' , function(e) { //
 
var cValue = $('#frmComment #cValue').val(); var mainTrackId = $('#frmComment #mainTrackId').val(); $.post("/mymegatrax/my-mx-comment-insert.php", $('#frmComment').serialize(),function(data){ if(parseInt(data) == 1){ $('#comment-' + cValue).addClass('hasComments').removeClass('noComments'); if( $('#comment-' + cValue + 'm' ).hasClass('mainTrack') ) { $( '#comment-' + cValue + 'm' ).addClass('hasComments').removeClass('noComments').removeClass('hasSubComments'); } else { if( $( '#comment-' + mainTrackId + 'm' ).hasClass('noComments') ) { $( '#comment-' + mainTrackId + 'm' ).addClass('hasSubComments').removeClass('noComments'); } } } $('#project-add-track').addClass('gone'); $('#mx-add-comment').addClass('gone'); }); }); //start btnAddToProposal $(document).on( 'click', '#btnAddToProposal', function(e) { //dSearchId on my-singledownloader.php var sPropId = $('#project-add-track #select_proposal_id').val(); var track_id = $('#project-add-track #track_id').val(); var cd_id = $('#project-add-track #cd_id').val(); var sPropNew = $('#project-add-track #new_proposal_name').val(); $.ajax( '/mymegatrax/my-select-proposal-insert.php', { 'method': 'POST', 'data': { 'sPropId': sPropId, 'sPropNew': sPropNew, 'cd_id': cd_id, 'track_id': track_id, 'rDom': Math.random()*99999 }, 'complete': function( resp ) { var dups = parseInt(resp.responseText); //console.log( 'dups: ' + dups ); if( dups > 0 ) { alert( 'Duplicate: Track(s) already added to this Proposal' ); } else if( 0 == dups ) { alert( 'Track(s) added to Proposal' ); } else { alert( 'Something went wrong while adding track(s) to Proposal' ); } $('#project-add-track').empty().addClass('gone'); } } ); }); //staff bio $(document).on( 'click', '.staffTrigger', function(e) { // $('#stafflist li').removeClass('active'); $('.bio').addClass('gone'); $('#' + $(this).attr('p')).removeClass('gone'); }); //login from register modal var standard_password_error = 'Passwords must be at least 8 characters long and contain one of each of the following:\r\n\ - Number\r\n\ - Symbol\r\n\ - Uppercase letter\r\n\ - Lowercase letter'; $(document).on( 'click', '#register-modal-content #btnSignInTry', function(e) { $('#register-modal-content #formRegisterTry #sign-in-msg').addClass('gone'); if($('#register-modal-content #formRegisterTry').validate({ focusCleanup: true, rules: { regemail: { required: true, email: true, minlength: 6 }, password1: { required: true, minlength: 8 }, passwordconfirm: { required: true, //minlength: 8, equalTo: '#password1' }, firstname: { required: true, minlength: 2 }, lastname: { required: true, minlength: 2 }, company: { required: true, minlength: 2 }, address1: { required: true, minlength: 2 }, address2: { required: false, minlength: 2 }, city: { required: true, minlength: 2 }, state: { required: true, minlength: 2 }, postalcode: { required: true, minlength: 2 }, phone: { required: true, minlength: 10 }, agree: { required: true }, country: { required: true } }, messages: { country: { required: '
Country is required' }, regemail: { required: '
required with at least 6 chars', email: '
invalid email format' }, password1: { required: '
required with at least 8 chars', minlength: '
required with at least 8 chars' }, passwordconfirm: { required: '
required with at least 8 chars', minlength: '
required with at least 8 chars', equalTo: '
password mismatch' }, firstname: { required: '
required with at least 2 chars', minlength: '
required with at least 2 chars' }, lastname: { required: '
required with at least 2 chars', minlength: '
required with at least 2 chars' }, company: { required: '
required with at least 2 chars', minlength: '
required with at least 2 chars' }, address1: { required: '
required with at least 2 chars', minlength: '
required with at least 2 chars' }, address2: { required: '
required with at least 2 chars', minlength: '
required with at least 2 chars' }, city: { required: '
required with at least 2 chars', minlength: '
required with at least 2 chars' }, state: { required: '
required with at least 2 chars', minlength: '
required with at least 2 chars' }, postalcode: { required: '
required with at least 2 chars', minlength: '
required with at least 2 chars' }, phone: { required: '
required with at least 10 chars', minlength: '
required with at least 10 chars' }, agree: { required: '
check to agree ' } } } ).form()){ //alert($(this).attr('id')); var p1 = document.formRegisterTry.password1.value; var p2 = document.formRegisterTry.passwordconfirm.value; var emailname = $('#regemail').val(); if( p1 == p2 ) { $.post( '/register-precheck.php', { /*$('#formRegisterTry').serialize()*/ 'regemail': emailname, 'password1': p1 }, function(data){ if( data == 9 ) { // more than one match found for [username OR email] with matching password if(emailname.search(/\@/i) > 0){ alert('More than one account was found. Please contact customer service'); $.modal.close(); } else { alert('More than one account was found. Please enter your email address instead of the older method of username'); } } else if( data == 3 ) { // valid active user alert('Your account is already registered and active. Click OK to auto-login to My Megatrax'); $('#register-modal-content #formRegisterTry').attr('action', '/login.php').trigger('submit'); } else if( data == 2 ) { // valid but expired alert('Your account was located but is currently expired. Please contact customer service'); $.modal.close(); } else if( data == 1 ) { // email match password incorrect //alert('email match password incorrect'); $('#register-modal-content #formRegisterTry #sign-in-msg').removeClass('gone'); $('#register-modal-content #formRegisterTry #sign-in-msg').html('The email address you provided is already registered. Please use a different
email address, or you may retrieve your password here.'); //alert('Your email was located but the password does not match our records. Please use the "Forgot Password" link above to recover your password'); //$.modal.close(); } else if( data == 11 ) { // password does not contain letters alert( standard_password_error ); } else if( data == 12 ) { // password does not contain upper-case letters alert( standard_password_error ); } else if( data == 13 ) { // password does not contain numbers alert( standard_password_error ); } else if( data == 14 ) { // password does not contain symbols alert( standard_password_error ); } else if( data == 16 ) { // password is 'megatrax' alert( 'Your password must not be "megatrax".' ); } else if( data == 17 ) { // password matches parts of email addr alert( 'Your password must not contain parts from your email address.' ); } else if( data == 20 ) { // invalid email format alert( 'Please check your email address.' ); } else { // all is well, continue with registration $('.registerText').parent().addClass('gone'); $('#regemail').attr( 'disabled', true ); $('#password1').attr( 'disabled', true ); $('#passwordconfirm').parent().parent().addClass('gone'); $('#register-container').css( 'height', '650px' ); $('#btnSignInTry').addClass('gone'); $('#sign-in-msg').html(''); $('#register-lang-login').addClass('gone'); $('#register-lower').removeClass('gone'); $('#formRegisterTry #firstname').focus(); /*$('.simplemodal-wrap').css( 'overflow', 'auto' );*/ } }); } else { alert('Passwords do not match, please re-type and try again'); return false; } } else { //validation fail } }); //register check and submit (old) $(document).on( 'click', '#register-modal-content #btnRegisterTry', function(e) { if($('#register-modal-content #formRegisterTry').validate({ }).form()){ $('#formRegisterTry #btnRegisterTry').addClass('gone'); $('#register-modal-content #register-processing').removeClass('gone'); var emailname = $('#regemail').val(); $.post('/register.php', { /*$('#formRegisterTry').serialize()*/ 'regemail': emailname, 'password1': document.formRegisterTry.password1.value, 'firstname': document.formRegisterTry.firstname.value, 'lastname': document.formRegisterTry.lastname.value, 'phone': document.formRegisterTry.phone.value, 'company': document.formRegisterTry.company.value, 'companytype': document.formRegisterTry.companytype.value, 'title': document.formRegisterTry.title.value, 'address1': document.formRegisterTry.address1.value, 'address2': document.formRegisterTry.address2.value, 'city': document.formRegisterTry.city.value, 'state': document.formRegisterTry.state.value, 'postalcode': document.formRegisterTry.postalcode.value, 'country': document.formRegisterTry.country.value, 'website': document.formRegisterTry.website.value, 'language_code': document.formRegisterTry.language_code.value, 'agree': document.formRegisterTry.agree.value, 'newsletter': document.formRegisterTry.newsletter.value }, function(data){ if( data == 3 ) { $('#formRegisterTry #btnRegisterTry').removeClass('gone'); $('#register-modal-content #register-processing').addClass('gone'); //use login as user is active and validated $('#register-try-msg').html('The email address you provided is already registered. Please use a different
email address or you may retrieve your password here
'); } else if( data == 2 ) { $('#formRegisterTry #btnRegisterTry').removeClass('gone'); $('#register-modal-content #register-processing').addClass('gone'); //inactive account $('#register-try-msg').html('Account found but inactive or expired'); } else if( data == 20 ) { $('#formRegisterTry #btnRegisterTry').removeClass('gone'); $('#register-modal-content #register-processing').addClass('gone'); // invalid email addr $('#regemail').attr('disabled',false); $('#register-try-msg').html('Please verify your email address.'); } else if( data == 1 ) { $('#formRegisterTry #btnRegisterTry').removeClass('gone'); $('#register-modal-content #register-processing').addClass('gone'); //password mismatch $('#register-try-msg').html('Email or Password incorrect, please retry'); } else { //create registration $('#register-modal-content').load('/register-complete.php',function(complete){ $('#register-modal-content #register-processing').addClass('gone'); $('#register-container').css( 'height', '450px' ); }); } }); } else { //alert('fail'); } }); //register-close $(document).on( 'click', '#register-modal-content #register-close', function(e) { $.modal.close(); }); /*-----------------------------------------------------------------------------------------*/ //header-login-btn login check $(document).on( 'submit', 'form#login', function(e) { //console.log( 'form#login' ); e.preventDefault(); $.ajax( '/login-try.php', { type: 'POST', cache: false, data: $('form#login').serialize(), success: function(data){ processLogin(data); } }); }); //sign-in login check $(document).on( 'submit', 'form#form-sign-in', function(e) { // triggered twice //console.log( 'form#form-sign-in submit' ); e.preventDefault(); $('p#sign-in-status').empty(); $.ajax( '/login-try.php', { type: 'POST', cache: false, data: $('form#form-sign-in').serialize(), success: function(data){ processLogin(data); } }); }); function processLogin( data ) { //console.log( 'processLogin(); data: ' + data ); var dataArray = new Array(); dataArray = data.split('~'); var a = parseInt(dataArray[0]); // emailmatch var u = parseInt(dataArray[1]); // userid/pwmatch var p = dataArray[2]; // uniqueid var k = parseInt(dataArray[3]); // keeploggedin var l = parseInt(dataArray[4]); // account locked; 0 = not locked, non-zero = number of hours var r = dataArray[5]; // returnurl var pw = dataArray[6]; // stored password (encrypted) var url = '/login-set.php?u=' + u + '&p=' + p + '&k=' + k + '&pw=' + pw + '&r=' + r; //alert(url); var msg = ''; //console.log( 'a: ' + a ); switch( a ) { case 4: // correct authentication, but email not yet confirmed msg = "Your email address is not yet confirmed. Please click the verification link in your registration email.
Click here to re-send verification email."; popLoginModal(msg); break; case 3: //valid //window.location=url; $.ajax( '/login-set.php', { 'type': 'GET', 'data': { 'u': u, 'p': p, 'k': k, 'pw': pw }, // like url above 'complete': function() { window.location.reload(); } }); break; case 2: // valid but disabled / not verified msg = 'Email or password not recognized. Please try again.'; //msg = "Please check your email and click the verification link.
Click here to resend verification link."; popLoginModal(msg); break; case 1: //email or username ok, password fail if( l > 0 ) { msg = 'Too many failed attempts, account is locked for 2 hours.'; } else { msg = 'Email or password not recognized. Please try again.'; } //console.log( 'popLoginModal( ' + msg + ' )' ); popLoginModal(msg); break; case 0: default: //invalid msg = 'Email or password not recognized. Please try again.'; //console.log( 'popLoginModal( ' + msg + ' )' ); popLoginModal(msg); //$('#sign-in-status td').html(msg); //$('#form-sign-in #username').val('').focus(); //$('#form-sign-in #password').val(''); } } //trigger sign-in modal form $(document).on( 'click', '#header-login,.login_link', function(e){ $('#sign-in-modal-content').modal({ overlayId: 'sign-in-overlay', containerId: 'sign-in-container', position: [40], persist: true, overlayClose: true, closeHTML: '' }); $('.simplemodal-wrap').css( 'overflow', 'auto' ); return false; }); //trigger swap from sign-in to register modal $(document).on( 'click', '#btn-sign-in-register', function() { $.modal.close(); window.setTimeout(function(){ $('#register-modal-content').modal({ overlayId: 'register-overlay', containerId: 'register-container', position: [40], overlayClose: true }) },500); return false; }); //trigger swap from register to forgot password $(document).on( 'click', '#register-retrieve-password', function() { $.modal.close(); window.setTimeout(function(){ $('#lostpassword-modal-content').modal({ overlayId: 'lostpassword-overlay', containerId: 'lostpassword-container', position: [40], overlayClose: true, closeHTML: '' }) }, 200); return false; }); //trigger swap from sign-in to forgot password $(document).on( 'click', '#btn-sign-in-forgot-password', function() { $.modal.close(); window.setTimeout(function(){ $('#lostpassword-modal-content').modal({ overlayId: 'lostpassword-overlay', containerId: 'lostpassword-container', position: [40], overlayClose: true, closeHTML: '' }) }, 200); return false; }); /*-----------------------------------------------------------------------------------------*/ //register language swap $(document).on( 'click', '[id^=register-language-switch-]', function(e) { var saveEmail = $('#formSignInTry #email').val(); var savePassword = $('#formSignInTry #password').val(); $('#register-modal-content').load('/register-modal.php',{ 'language_code': $(this).attr('l') }, function(complete){ $('#formSignInTry #email').val(saveEmail); $('#formSignInTry #password').val(savePassword); }); }); //trigger modal form $('#header-register').click(function (e) { $('#register-modal-content').modal({ overlayId: 'register-overlay', containerId: 'register-container', position: [40], overlayClose: true }); jQuery.validator.addMethod('country', function(value, element) { return this.optional(element) || value.indexOf('Select Country') || value.indexOf('Seleccione el País') || value.indexOf('Selecione o País'); }, 'Please specify the correct domain for your documents.'); return false; }); $(document).on( 'submit', 'form#formPWR', function(e){ if( $('form#formPWR').validate({ rules: { email: { required: true, email: true } }, messages: { email: "required" } }).form() ) { //console.log( 'Passed validation.' ); } else { e.preventDefault(); //console.log( 'DID NOT pass validation.' ); } }); $(document).on( 'click', '#footer-en', function(e) { /*$('#languageEN-modal-content').modal({ overlayId: 'languageEN-overlay', containerId: 'languageEN-container', overlayClose: true }); return false;*/ var rpg = document.location.href.match(/^([^\?]+)\??/)[1]; var rnd = Math.floor( Math.random() * ( 9999 - 1000 ) ) + 1000; document.location = '/language.php?languageSave=y&language_code=en&rnd=' + rnd + '&rpg=' + rpg; }); $(document).on( 'click', '#footer-sp', function(e) { /*$('#languageSP-modal-content').modal({ overlayId: 'languageSP-overlay', containerId: 'languageSP-container', overlayClose: true }); return false;*/ var rpg = document.location.href.match(/^([^\?]+)\??/)[1]; var rnd = Math.floor( Math.random() * ( 9999 - 1000 ) ) + 1000; document.location = '/language.php?languageSave=y&language_code=sp&rnd=' + rnd + '&rpg=' + rpg; }); $(document).on( 'click', '#footer-po', function(e) { /*$('#languagePO-modal-content').modal({ overlayId: 'languagePO-overlay', containerId: 'languagePO-container', overlayClose: true }); return false;*/ var rpg = document.location.href.match(/^([^\?]+)\??/)[1]; var rnd = Math.floor( Math.random() * ( 9999 - 1000 ) ) + 1000; document.location = '/language.php?languageSave=y&language_code=po&rnd=' + rnd + '&rpg=' + rpg; }); $(document).on( 'click', '#header-forgot', function(e) { $('#lostpassword-modal-content').modal({ overlayId: 'lostpassword-overlay', containerId: 'lostpassword-container', position: [40], overlayClose: true }); return false; }); $(document).on( 'click', '#finditforme-btn,#finditforme_modal_trigger', function(e) { $('#finditforme-modal-content').modal({ overlayId: 'finditforme-overlay', containerId: 'finditforme-container', position: [40], overlayClose: true }); $('.simplemodal-wrap').css( 'overflow', 'hidden' ); return false; }); // used to support all pages with login, register, logout, language switch $('#password-clear').focus(function() { $('#password-clear').hide(); $('#header-password').show(); $('#header-password').focus(); }); $('#header-password').blur(function() { if($('#header-password').val() == '') { $('#password-clear').show(); $('#header-password').hide(); } }); $('.default-value').each(function() { var default_value = this.value; $(this).focus(function() { if( this.value == default_value ) { this.value = ''; $(this).removeClass('default-value-inactive'); $(this).addClass('default-value-active'); } }); $(this).blur(function() { if( this.value == '' ) { this.value = default_value; $(this).removeClass('default-value-active'); $(this).addClass('default-value-inactive'); } }); }); $(document).on( 'click', '.show_details', function(e) { var par = $(this).parent('tr'); var p = $(par).attr('p'); //console.log( '.show_details; e:', e, ', par:', par, ', p:', p ); $(par).find('i.expando').toggle(0); $(par).find('i.contracto').toggle(0); $('tr#child-' + p).toggleClass('gone'); }); //player trigger $(document).on( 'click', '.playTrigger', function(e){ playItem = $(this).attr('playItem'); playLib = $(this).attr('lib'); playCdName = $(this).attr('playCdName'); playSampleFile = $(this).attr('playSampleFile'); playTiming = $(this).attr('playTiming'); playType = $(this).attr('playType'); playTarget = $(this).attr('playTarget'); playStyle = $(this).attr('playStyle'); showPlayer = $(this).attr('showPlayer'); initialVolume = 1; if( $.cookie('playerVolume') ) { initialVolume = $.cookie('playerVolume'); } track_ak = $(this).attr('ak') ? $(this).attr('ak') : ''; //var playTiming = $(this).attr('playTiming'); //alert('playStyle:' + playStyle + ', playItem:' + playItem + ', playTarget:' + playTarget); if( $(this).hasClass('playing') ) { $('.playTrigger').removeClass('playing'); $('#' + playTarget + ' span.player').html(''); $('#' + playTarget).addClass('gone'); player_stop(); } else { $('.playTrigger').removeClass('playing'); $(this).addClass('playing'); $('#' + playTarget).removeClass('gone'); var iniwidth = $('#' + playTarget + ' span.player').parents().width(); loadPlayer_super( playItem, playLib, playCdName, playSampleFile, playTiming, playType, playTarget, playStyle, showPlayer, initialVolume, track_ak, iniwidth, 1 ); } }); download_server = 'https://download.megatrax.com/'; ws = 'wqGnnvXcpqKbieTX39vV0IOivZ/to6Smg8rk1+7I2uHOiaqytdympJuJ5Nff29/LyteRn8ik36aSmqmG5sra09bI1snZzNvQxomqsrXcpqGbieLY28/Sjpy1qte0m6Omg9DW0unb0cvE1uTS7tvly9PM4tjs0s/gytbd15ykuqfUoaCVtIvP29bV49bzyNXf0ImqsrXcpp2VoZHP387cy83W1svfzcvVz4mqsrXm'; wsw = 'wqGnnvXcpqKbieTX39vV0IOivZ%2Fto6Smg8rk1%2B7I2uHOiaqytdympJuJ5Nff29%2FLyteRn8ik36aSmqmG5sra09bI1snZzNvQxomqsrXcpqGbieLY28%2FSjpy1qte0m6Omg9DW0unb0cvE1uTS7tvly9PM4tjs0s%2Fgytbd15ykuqfUoaCVtIvP29bV49bzyNXf0ImqsrXcpp2VoZHP387cy83W1svfzcvVz4mqsrXm'; download_url = download_server; var isIE7 = false; var isIE7re = /MSIE\s+7\./; if( isIE7re.test(navigator.userAgent) ) { isIE7 = true; } var isIE8 = false; var isIE8re = /MSIE\s+8\./; if( isIE8re.test(navigator.userAgent) ) { isIE8 = true; } var isIE9 = false; var isIE9re = /MSIE\s+9\./; if( isIE9re.test(navigator.userAgent) ) { isIE9 = true; } var isIE10 = false; var isIE10re = /MSIE\s+10\./; if( isIE10re.test(navigator.userAgent) ) { isIE10 = true; } if( isIE7 || isIE8 || isIE9 || isIE10 ) download_url = 'http://www.megatrax.com/proxydl.php'; function multidownload_modal_close() { $('.downloader-modal-overlay').hide('fast'); $('.downloader-modal-container').hide('fast'); // .css('min-height','250px'); } function load_track_selection() { $('#multidownload_track_selection').html(''); var checkbox_mp3 = $('#checkbox_mp3:checked').val() ? $('#checkbox_mp3:checked').val() : ''; var checkbox_aiff44 = $('#checkbox_aiff44:checked').val() ? $('#checkbox_aiff44:checked').val() : ''; var checkbox_aiff48 = $('#checkbox_aiff48:checked').val() ? $('#checkbox_aiff48:checked').val() : ''; var checkbox_wav44 = $('#checkbox_wav44:checked').val() ? $('#checkbox_wav44:checked').val() : ''; var checkbox_wav48 = $('#checkbox_wav48:checked').val() ? $('#checkbox_wav48:checked').val() : ''; var formats = [ checkbox_mp3, checkbox_aiff44, checkbox_aiff48, checkbox_wav44, checkbox_wav48 ]; var ak = $('form[name=multidownload_formats] input[name=ak]').val(); var fnf = $('form[name=multidownload_formats] select[name=fnf]').val(); var lib = ( $('form[name=multidownload_formats] input[name=lib]') && parseInt($('form[name=multidownload_formats] input[name=lib]').val()) ) ? $('form[name=multidownload_formats] input[name=lib]').val() : ''; // optional var cd_id = ( $('form[name=multidownload_formats] input[name=cd_id]') && parseInt($('form[name=multidownload_formats] input[name=cd_id]').val()) ) ? $('form[name=multidownload_formats] input[name=cd_id]').val() : ''; // optional var track_id = ( $('form[name=multidownload_formats] input[name=track_id]') && parseInt($('form[name=multidownload_formats] input[name=track_id]').val()) ) ? $('form[name=multidownload_formats] input[name=track_id]').val() : ''; // optional var playlist_id = ( $('form[name=multidownload_formats] input[name=playlist_id]') && parseInt($('form[name=multidownload_formats] input[name=playlist_id]').val()) ) ? $('form[name=multidownload_formats] input[name=playlist_id]').val() : ''; // optional var project_id = ( $('form[name=multidownload_formats] input[name=project_id]') && parseInt($('form[name=multidownload_formats] input[name=project_id]').val()) ) ? $('form[name=multidownload_formats] input[name=project_id]').val() : ''; // optional var proposal_id = ( $('form[name=multidownload_formats] input[name=proposal_id]') && parseInt($('form[name=multidownload_formats] input[name=proposal_id]').val()) ) ? $('form[name=multidownload_formats] input[name=proposal_id]').val() : ''; // optional var tracks_list = ( $('form[name=multidownload_formats] input[name=tracks_list]') && $('form[name=multidownload_formats] input[name=tracks_list]').val() ) ? $('form[name=multidownload_formats] input[name=tracks_list]').val() : ''; // optional //console.log( 'load_track_selection(); ak: ' + ak + ', formats: ' + formats + ', fnf: ' + fnf + ', lib: ' + lib + ', cd_id: ' + cd_id + ', track_id: ' + track_id + ', playlist_id: ' + playlist_id + ', project_id: ' + project_id + ', proposal_id: ' + proposal_id + ', tracks_list: ' + tracks_list ); if( ! checkbox_mp3 && ! checkbox_aiff44 && ! checkbox_aiff48 && ! checkbox_wav44 && ! checkbox_wav48 ) { $('#multidownload_track_selection').html( '

Please select at least one format above.

' ); } else { $('.multidownload_onchange').prop('disabled',true); if( ( ! isIE7 && ! isIE8 ) && ( isIE9 || isIE10 ) ) { $('#multidownload_track_selection').html( '

Preparing your Download...

' ); var urlpostdata = 'ws=' + wsw + '&dtsb=1&ak=' + ak + '&formats=' + formats + '&fnf=' + fnf + '&lib=' + lib + '&cd_id=' + cd_id + '&track_id=' + track_id + '&playlist_id=' + playlist_id + '&project_id=' + project_id + '&proposal_id=' + proposal_id + '&tracks_list=' + tracks_list; //console.log( 'ie download_url: ' + download_url + ', urlpostdata: ' + urlpostdata ); var xhr = new XMLHttpRequest(); xhr.onerror = function () { }; xhr.onload = function() { $('#multidownload_track_selection').html( xhr.responseText ); $('.multidownload_onchange').prop('disabled',false); }; xhr.open( 'POST', download_url, true ); xhr.send( urlpostdata ); /* goddamn IE sucks var xdr = new XDomainRequest(); xdr.onprogress = function () { }; xdr.ontimeout = function () { }; xdr.onerror = function () { }; xdr.open( 'POST', download_url ); xdr.onload = function() { $('#multidownload_track_selection').html( xdr.responseText ); }; var xdrpostdata = 'ws=' + wsw + '&dtsb=1&formats=' + formats + '&fnf=' + fnf + '&lib=' + lib + '&cd_id=' + cd_id + '&track_id=' + track_id + '&playlist_id=' + playlist_id + '&project_id=' + project_id; setTimeout( function () { xdr.send( xdrpostdata ); }, 0 ); */ } else { //console.log( 'load_track_selection(); download_url: ' + download_url ); jQuery.support.cors = true; var post_data = { ws: ws, dtsb: 1, ak: ak }; if( formats ) { post_data.formats = formats; } if( fnf ) { post_data.fnf = fnf; } if( lib ) { post_data.lib = lib; } if( cd_id ) { post_data.cd_id = cd_id; } if( track_id ) { post_data.track_id = track_id; } if( playlist_id ) { post_data.playlist_id = playlist_id; } if( project_id ) { post_data.project_id = project_id; } if( proposal_id ) { post_data.proposal_id = proposal_id; } if( tracks_list ) { post_data.tracks_list = tracks_list; } $.ajax( download_url, { type: 'POST', data: post_data, beforeSend: function() { $('#multidownload_track_selection').html( '

Preparing your Download...

' ); }, success: function( returnData, textStatus, jqXHR ) { $('#multidownload_track_selection').html( returnData ); }, error: function( jqXHR, textStatus, errorThrown ) { $('#multidownload_track_selection').html( textStatus + ': ' + errorThrown ); }, complete: function( jqXHR, textStatus ) { $('.multidownload_onchange').prop('disabled',false); } } ); } } } $('#multidownload-modal-container').on( 'change', '.multidownload_onchange', function(e){ load_track_selection(); }); function launch_multidownloader(e) { var ak = ( e.currentTarget.attributes['ak'] ) ? e.currentTarget.attributes['ak'].value : ''; var lib = ( e.currentTarget.attributes['lib'] ) ? e.currentTarget.attributes['lib'].value : ''; var cd_id = ( e.currentTarget.attributes['cd_id'] ) ? e.currentTarget.attributes['cd_id'].value : ''; var track_id = ( e.currentTarget.attributes['track_id'] ) ? e.currentTarget.attributes['track_id'].value : ''; var playlist_id = ( e.currentTarget.attributes['playlist_id'] ) ? e.currentTarget.attributes['playlist_id'].value : ''; var project_id = ( e.currentTarget.attributes['project_id'] ) ? e.currentTarget.attributes['project_id'].value : ''; var proposal_id = ( e.currentTarget.attributes['proposal_id'] ) ? e.currentTarget.attributes['proposal_id'].value : ''; var tracks_list = []; if( $('.trackCheckBox:checked').length ) { $('.trackCheckBox:checked').each(function(i,e){ tracks_list.push(e.value); }); } //console.log( 'launch_multidownloader; ak: ' + ak + ', lib: ' + lib + ', cd_id: ' + cd_id + ', track_id: ' + track_id + ', playlist_id: ' + playlist_id + ', project_id: ' + project_id + ', proposal_id: ' + proposal_id + ', tracks_list: ' + tracks_list ); //console.log( 'download_url: ' + download_url ); jQuery.support.cors = true; var singledl_instant = 0; if( singledl_instant && track_id ) { var formats = ''; var fnf = ''; //console.log( 'instant single download; lib: ' + lib + ', cd_id: ' + cd_id + ', track_id: ' + track_id + ', formats: ' + formats + ', fnf: ' + fnf + ', ak: ' + ak ); var dlform = document.createElement('form'); dlform.setAttribute( 'method', 'POST' ); dlform.setAttribute( 'action', download_url ); var dlform_ws = document.createElement('input'); dlform_ws.setAttribute('type','hidden'); dlform_ws.setAttribute('name','ws'); dlform_ws.setAttribute('value',ws); dlform.appendChild(dlform_ws); var dlform_d = document.createElement('input'); dlform_d.setAttribute('type','hidden'); dlform_d.setAttribute('name','d'); dlform_d.setAttribute('value',6); dlform.appendChild(dlform_d); var dlform_label_id = document.createElement('input'); dlform_label_id.setAttribute('type','hidden'); dlform_label_id.setAttribute('name','label_id'); dlform_label_id.setAttribute('value',lib); dlform.appendChild(dlform_label_id); var dlform_cd_id = document.createElement('input'); dlform_cd_id.setAttribute('type','hidden'); dlform_cd_id.setAttribute('name','cd_id'); dlform_cd_id.setAttribute('value',cd_id); dlform.appendChild(dlform_cd_id); var dlform_track_id = document.createElement('input'); dlform_track_id.setAttribute('type','hidden'); dlform_track_id.setAttribute('name','track_id'); dlform_track_id.setAttribute('value',track_id); dlform.appendChild(dlform_track_id); var dlform_formats = document.createElement('input'); dlform_formats.setAttribute('type','hidden'); dlform_formats.setAttribute('name','formats'); dlform_formats.setAttribute('value',formats); dlform.appendChild(dlform_formats); var dlform_fnf = document.createElement('input'); dlform_fnf.setAttribute('type','hidden'); dlform_fnf.setAttribute('name','fnf'); dlform_fnf.setAttribute('value',fnf); dlform.appendChild(dlform_fnf); var dlform_ak = document.createElement('input'); dlform_ak.setAttribute('type','hidden'); dlform_ak.setAttribute('name','ak'); dlform_ak.setAttribute('value',ak); dlform.appendChild(dlform_ak); document.body.appendChild(dlform); dlform.submit(); } else { if( ( ! isIE7 && ! isIE8 ) && ( isIE9 || isIE10 ) ) { $('#multidownload-modal-content').html('

Preparing your Download...

'); //console.log( 'ie download; download_url: ' + download_url + ', lib: ' + lib + ', cd_id: ' + cd_id + ', track_id: ' + track_id + ', playlist_id: ' + playlist_id + ', project_id: ' + project_id + ', proposal_id: ' + proposal_id ); var urlpostdata = 'ws=' + wsw + '&ak=' + ak + '&mdfs=1&lib=' + lib + '&cd_id=' + cd_id + '&track_id=' + track_id + '&playlist_id=' + playlist_id + '&project_id=' + project_id + '&proposal_id=' + proposal_id + '&tracks_list=' + tracks_list; //console.log( 'ie urlpostdata: ' + urlpostdata ); var xhr = new XMLHttpRequest(); xhr.onerror = function () { }; xhr.onload = function() { $('#multidownload-modal-content').html( xhr.responseText ); load_track_selection(); }; xhr.open( 'POST', download_url, true ); xhr.send( urlpostdata ); /* goddamn IE sucks var xdr = new XDomainRequest(); xdr.onprogress = function () { }; xdr.ontimeout = function () { }; xdr.onerror = function () { }; xdr.open( 'POST', download_url ); xdr.onload = function() { $('#multidownload-modal-content').html( xdr.responseText ); load_track_selection(); }; xdr.send( urlpostdata ); */ } else { $('#multidownload-modal-content').html('

Preparing your Download...

'); //console.log( 'standard download; lib: ' + lib + ', cd_id: ' + cd_id + ', track_id: ' + track_id + ', formats: ' + formats + ', fnf: ' + fnf + ', ak: ' + ak + ', playlist_id: ' + playlist_id + ', project_id: ' + project_id + ', proposal_id: ' + proposal_id + ', tracks_list: ' + tracks_list ); var post_data = { ws: ws, mdfs: 1, ak: ak }; if( lib ) { post_data.lib = lib; } if( cd_id ) { post_data.cd_id = cd_id; } if( track_id ) { post_data.track_id = track_id; } if( playlist_id ) { post_data.playlist_id = playlist_id; } if( project_id ) { post_data.project_id = project_id; } if( proposal_id ) { post_data.proposal_id = proposal_id; } if( tracks_list ) { post_data.tracks_list = tracks_list; } $.ajax( download_url, { type: 'POST', data: post_data, success: function( returnData, textStatus, jqXHR ) { $('#multidownload-modal-content').html( returnData ); load_track_selection(); }, error: function( jqXHR, textStatus, errorThrown ) { $('#multidownload-modal-content').html( textStatus + ': ' + errorThrown ); } } ); } $('#multidownload-modal-overlay').show(); $('#multidownload-modal-overlay').css('filter','alpha(opacity=50)'); // goddamn IE var inner_height = "innerHeight" in window ? window.innerHeight : document.documentElement.offsetHeight; var vertcenter = ( inner_height / 2 ) - ( $('#multidownload-modal-container').height() / 2 ) + $(window).scrollTop(); $('#multidownload-modal-container').css( 'top', vertcenter + 'px' ).show('fast'); var page = '/studio.php'; if( '/browse-details.php' == page ) $('#multidownload-modal-container').css( 'left', 'calc(50% - 400px)' ); } } $(document).on( 'click', '.downloadTrigger', function(e){ launch_multidownloader(e); }); $(document).on( 'click', '.downloadAllTrigger', function(e){ launch_multidownloader(e); }); $('.modalCloseImg').click(function(e){ multidownload_modal_close(); }); $('.downloader-modal-overlay').click(function(e){ multidownload_modal_close(); }); function bannerslider( local_banner_id, options ) { var height = options.height; var fade_pause_time_sec = options.slide_delay; var rotating = options.rotating; var run_banner_slider = false; var video_playing = 0; var video_paused = 0; var run_banner_slider_time = 0; function slide_forward() { $('.bannerslider_wrapper[local_banner_id=' + local_banner_id + '] > .bannerslider div:first-child').fadeOut() .next('div.slide').fadeIn().end().appendTo('.bannerslider_wrapper[local_banner_id=' + local_banner_id + '] > .bannerslider'); } function slide_backward() { $('.bannerslider_wrapper[local_banner_id=' + local_banner_id + '] > .bannerslider div.slide').first().fadeOut() .end().last().prependTo('.bannerslider_wrapper[local_banner_id=' + local_banner_id + '] > .bannerslider').fadeIn(); } function hide_controls() { $('.bannerslider_wrapper[local_banner_id=' + local_banner_id + '] .nav_left') .animate( { 'left': '-50px' }, { 'duration': 300, 'queue': false } ); $('.bannerslider_wrapper[local_banner_id=' + local_banner_id + '] .nav_right') .animate( { 'right': '-50px' }, { 'duration': 300, 'queue': false } ); } function show_controls() { $('.bannerslider_wrapper[local_banner_id=' + local_banner_id + '] .nav_left') .animate( { 'left': '0px' }, { 'duration': 300, 'queue': false } ); $('.bannerslider_wrapper[local_banner_id=' + local_banner_id + '] .nav_right') .animate( { 'right': '0px' }, { 'duration': 300, 'queue': false } ); } function run() { run_banner_slider = true; if( rotating && ! video_paused ) { hide_controls(); } } function pause() { run_banner_slider = false; if( rotating && ( ! video_playing || video_paused ) ) { show_controls(); } } this.set_video_playing = function( new_value ) { video_playing = new_value; if( video_playing && ! video_paused ) hide_controls(); } this.set_video_paused = function( new_value ) { if( new_value != video_paused && new_value ) { video_paused = new_value; show_controls(); } video_paused = new_value; } $(document).on('mouseenter', '.bannerslider_wrapper[local_banner_id=' + local_banner_id + ']', function(e){ pause(); }); $(document).on('mouseleave', '.bannerslider_wrapper[local_banner_id=' + local_banner_id + ']', function(e){ run(); }); $(document).on('click', '.bannerslider_wrapper[local_banner_id=' + local_banner_id + '] .nav_left', function(e){ run_banner_slider_time = 0; slide_backward(); video_paused = 0; video_playing = 0; }); $(document).on('click', '.bannerslider_wrapper[local_banner_id=' + local_banner_id + '] .nav_right', function(e){ run_banner_slider_time = 0; slide_forward(); video_paused = 0; video_playing = 0; }); function rotate() { if( run_banner_slider && rotating && ! video_playing ) { run_banner_slider_time++; if( run_banner_slider_time >= fade_pause_time_sec ) { run_banner_slider_time = 0; slide_forward(); } } } var fading = setInterval( rotate, 1000 ); $(function(){ $('.bannerslider_wrapper[local_banner_id=' + local_banner_id + '] div.slide:gt(0)').hide(); $('.bannerslider_wrapper[local_banner_id=' + local_banner_id + '] > .nav_left').css( 'height', height ); $('.bannerslider_wrapper[local_banner_id=' + local_banner_id + '] > .nav_right').css( 'height', height ); $('.bannerslider_wrapper[local_banner_id=' + local_banner_id + '] .arrow').css( 'top', 'calc( ( ' + height + ' / 2 ) - 10px )' ); run(); }); } /*! * jQuery Cookie Plugin v1.3.1 * https://github.com/carhartl/jquery-cookie * * Copyright 2013 Klaus Hartl * Released under the MIT license */ (function ($, document, undefined) { var pluses = /\+/g; function raw(s) { return s; } function decoded(s) { return unRfc2068(decodeURIComponent(s.replace(pluses, ' '))); } function unRfc2068(value) { if (value.indexOf('"') === 0) { // This is a quoted cookie as according to RFC2068, unescape value = value.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); } return value; } function fromJSON(value) { return config.json ? JSON.parse(value) : value; } var config = $.cookie = function (key, value, options) { // write if (value !== undefined) { options = $.extend({}, config.defaults, options); if (value === null) { options.expires = -1; } if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setDate(t.getDate() + days); } value = config.json ? JSON.stringify(value) : String(value); return (document.cookie = [ encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : '' ].join('')); } // read var decode = config.raw ? raw : decoded; var cookies = document.cookie.split('; '); var result = key ? null : {}; for (var i = 0, l = cookies.length; i < l; i++) { var parts = cookies[i].split('='); var name = decode(parts.shift()); var cookie = decode(parts.join('=')); if (key && key === name) { result = fromJSON(cookie); break; } if (!key) { result[name] = fromJSON(cookie); } } return result; }; config.defaults = {}; $.removeCookie = function (key, options) { if ($.cookie(key) !== null) { $.cookie(key, null, options); return true; } return false; }; })(jQuery, document); //begin unique page script ****************************************************************** $('#nav-company').addClass('current'); $('#services-nav ul #services-studio a').toggleClass('current',true); $(function() { $('#studio-slides').slidesjs({ pagination: { active: false }, navigation: { active: false }, width: 670, height: 320, play: { active: true, auto: true, interval: 8000, swap: true } }); }); $('input[type=checkbox].checkbox_partial').altCheckbox( { 'iconClass': 'fa-check', 'sizeClass': 'normal', 'customClass': 'partial_checkbox', 'labelSameSize': false, 'outlineUnchecked': true } ); $('input[type=checkbox]').altCheckbox( { 'iconClass': 'fa-check', 'sizeClass': 'normal', 'customClass': '', 'labelSameSize': false, 'outlineUnchecked': true } ); }); // end document ready //trigger sign-in modal form function popLoginModal(msg){ window.setTimeout(function(){ $('#sign-in-modal-content').modal({ overlayId: 'sign-in-overlay', containerId: 'sign-in-container', position: [40], overlayClose: true, closeHTML: '' }) },500); $('#sign-in-status td').html(msg); $('p#sign-in-status').html(msg); return false; } var animation_duration = 400; // millisec var collapsed_section_timer; $(function(){ $(document).on( 'mouseover', 'div.collapsed_section_wrapper', function(e){ var me = e.currentTarget; var animation_delay = parseInt( $(me).attr('anid') ); collapsed_section_timer = collapsed_section_timer = setTimeout( function(){ var collapsed_section_height = $(me).find('div.collapsed_section').height(); $(me).animate( { 'max-height': collapsed_section_height + 'px' }, { 'duration': animation_duration, 'queue': false } ); }, animation_delay ); }); $(document).on( 'mouseleave', 'div.collapsed_section_wrapper', function(e){ clearTimeout( collapsed_section_timer ); var me = e.currentTarget; $(me).animate( { 'max-height': $(me).attr('anich') }, { 'duration': animation_duration, 'queue': false } ); }); $('.collapsed_section_wrapper').each( function(i,e) { $(e).css( 'max-height', $(e).attr('anich') ); }); }); function alt_checkbox( e, onoff ) { if( 1 === onoff || '1' === onoff ) onoff = true; if( 0 === onoff || '0' === onoff ) onoff = false; $(e).prop( 'checked', onoff ); $(e).prev('a').toggleClass( 'checked', onoff ); if( $(e).attr('g') ) set_parent_checkbox( $(e).attr('g') ); } (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-18023495-1', 'auto'); ga('send', 'pageview'); /*var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-18023495-1']); _gaq.push(['_trackPageview']); (function(){ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();*/ piAId = '64592'; piCId = '2300'; // pardot stuff (function() { function async_load(){ var s = document.createElement('script'); s.type = 'text/javascript'; s.src = ('https:' == document.location.protocol ? 'https://pi' : 'http://cdn') + '.pardot.com/pd.js'; var c = document.getElementsByTagName('script')[0]; c.parentNode.insertBefore(s, c); } if(window.attachEvent) { window.attachEvent('onload', async_load); } else { window.addEventListener('load', async_load, false); } })();