function check_description_characters_left(field,maxlimit) { var characters_left = maxlimit - field.value.length; $('#description_characters_left').html(characters_left); } function open_voucher_preview(voucherId, voucherImage){ $('#voucher_preview_link_'+voucherId).attr('href', voucherImage); $('#voucher_preview_link_'+voucherId).lightbox({start:true,events:false}); } var actual_elementId = 'promoone'; var old_preview_image = 3; var promo_tab = new Array('promoone', 'promotwo', 'promothree', 'promofour'); var max_img_no = 3; function change_promo(elementId){ if(actual_elementId!=elementId){ $('#'+promo_tab[actual_elementId]).css('display', 'none'); $('#'+promo_tab[elementId]).fadeIn("slow"); actual_elementId = elementId; old_preview_image = elementId; } } function move_next_promo(){ if(old_preview_image limit) { where_new_line = tab[i].substring(limit - 20 , limit); var tab_line = where_new_line.split(" "); var where_new_line2 = where_new_line.replace(tab_line[(tab_line.length-2)]+" ", tab_line[(tab_line.length-2)]+"\n"); new_description_text = new_description_text.replace(where_new_line, where_new_line2); $('#description').val(new_description_text) check_description_length(); } } */ } function check_date(date_type){ document.getElementById('is_'+date_type+'_date_1').checked=true; generate_voucher_prev_url(); } function uncheck_date(date_type){ document.getElementById(''+date_type+'_date').value = ''; generate_voucher_prev_url(); } function show_short_url_info_v(infoId){ $("#short_url_info_"+infoId).css('display','inline'); } function hide_short_url_info_v(infoId){ $("#short_url_info_"+infoId).css('display','none'); } function select_area(id,selected){ $('#area').html(''); $('#area').attr({disabled: false}); $('#area').load('http://www.moneyoffvouchers.net/ajax_create_area_search_options.php?country='+id+'&selected='+selected+''); } //start business actions function get_all_width(){ var theWidth; // Window dimensions: if (window.innerWidth) { theWidth=window.innerWidth; } else if (document.documentElement.clientWidth) { theWidth=document.documentElement.clientWidth; } else if (document.body) { theWidth=document.body.clientWidth; } return theWidth; } function get_all_height(){ var theHeight; // Window dimensions: if (window.innerHeight) { theHeight=window.innerHeight; } else if (document.documentElement.clientHeight) { theHeight=document.documentElement.clientHeight; } else if (document.body) { theHeight=document.body.clientHeight; } return theHeight; } var space_left = ((get_all_width()-1000)/2)+730; var space_top = 120; var active_submenu = 0; function show_submenu(submenu_id){ document.getElementById('dpop_'+active_submenu).style.display = 'none'; active_submenu = submenu_id; var xx = space_left; var yy = space_top+(submenu_id*83); document.getElementById('dpop_'+submenu_id).style.left = xx+'px'; document.getElementById('dpop_'+submenu_id).style.top = yy+'px'; document.getElementById('dpop_'+submenu_id).style.display = 'block'; } function hide_active_submenu(){ //if(active_submenu!=submenu_id){ document.getElementById('dpop_'+active_submenu).style.display = 'none'; active_submenu = 0; //} } additional_height = 0; function share_voucher(voucher_id, submenu_id){ var space_top = 100; //hide_active_submenu(); jQuery.ajax({ type: "POST", url: 'http://www.moneyoffvouchers.net/ajax_share_voucher_form.php', data: "voucher_id="+voucher_id, success: function(msg){ //var xx = space_left; var yy = space_top+(submenu_id*145); $('#lightwindow_div_content').html(msg); $('#lightwindow_div').slideDown('fast'); $('#lightwindow_div').css('position','absolute'); $('#lightwindow_div').css('top',yy+'px'); } }); } function send_to_mobile(voucher_id, submenu_id){ var space_top = 100; //hide_active_submenu(); jQuery.ajax({ type: "POST", url: 'http://www.moneyoffvouchers.net/ajax_send_to_mobile_form.php', data: "voucher_id="+voucher_id, success: function(msg){ //var xx = space_left; var yy = space_top+(submenu_id*145); $('#lightwindow_div_content').html(msg); $('#lightwindow_div').slideDown('fast'); $('#lightwindow_div').css('position','absolute'); $('#lightwindow_div').css('top',yy+'px'); } }); } function voucher_add_to_package(voucher_id, submenu_id){ var space_top = 100; //hide_active_submenu(); jQuery.ajax({ type: "POST", url: 'http://www.moneyoffvouchers.net/ajax_voucher_add_to_package_form.php', data: "voucher_id="+voucher_id, success: function(msg){ //var xx = space_left; var yy = space_top+(submenu_id*145); $('#lightwindow_div_content').html(msg); $('#lightwindow_div').slideDown('fast'); $('#lightwindow_div').css('position','absolute'); $('#lightwindow_div').css('top',yy+'px'); } }); } function open_tcs(terms_id){ var yy = space_top+83; jQuery.ajax({ type: "GET", url: 'http://www.moneyoffvouchers.net/ajax_show_tcs.php', data: "terms_id="+terms_id, success: function(msg){ //var xx = space_left; $('#lightwindow_div').css('width','700px'); $('#lightwindow_div_content').html(msg); $('#lightwindow_div').slideDown('fast'); $('#lightwindow_div').css('position','absolute'); $('#lightwindow_div').css('top',yy+'px'); } }); } function open_vtcs(vterms, submenu_id){ var space_top = 100; var yy = space_top+(submenu_id*145); //var xx = space_left; $('#lightwindow_div').css('width','700px'); $('#lightwindow_div_content').html("

Terms & Conditions

"+vterms); $('#lightwindow_div').slideDown('fast'); $('#lightwindow_div').css('position','absolute'); $('#lightwindow_div').css('top',yy+'px'); } function open_lightwindow(site_content){ $('#lightwindow_div_content').html(site_content); $('#lightwindow_div').slideDown('fast'); $('#lightwindow_div').css('position','absolute'); var top_position = (get_all_height()-485)/2; $('#lightwindow_div').css('top',top_position+'px'); window.scrollTo(0,0); } function close_lightwindow(){ $('#lightwindow_div').slideUp('fast'); } //end business actions function show_tour(iii){ var tab = new Array('hunter', 'provider'); var src = '/temp_img/'+tab[iii]+'-tour.swf'; var ddd = document.getElementById('tour'); ddd.style.display = 'block'; var so_30 = new SWFObject(src, "hp_flash_movie_30", "378", "348", "8", "#FFFFFF"); so_30.write("tour_flash"); } function close_tour(){ var ddd = document.getElementById('tour'); ddd.style.display = 'none'; } var selected_image_from_library = 0; var nob = 0; function generate_voucher_prev_url(){ var url_data = 'line1='+$('#line1').val(); url_data += '&line2='+$('#line2').val(); url_data += '&description='+$('#description').val().replace(/\n/g, "||"); url_data += '&template=3'; url_data += '&code='+$('#code').val(); url_data += '&start_date='+$('#start_date').val(); url_data += '&expiry_date='+$('#expiry_date').val(); url_data += '&bid='+$('#bid').val(); if($('#use_business_logo:checked').is(':checked')){ url_data += '&use_business_logo=y'; }else{ url_data += '&use_business_logo=n'; } url_data += '&image_library_id='+$('#image_library_id').val(); url_data += '&image_library_src='+$('#image_library_src').val(); url_data += '&authorized_by='+$('#authorized_by').val(); nob = $(".placeid:checked").length; url_data += '&nob='+nob; //alert(url_data); //rest of data... //$('#preview_voucher_button').attr('href', 'http://www.moneyoffvouchers.net/ajax_generate_voucher_image.php?date=1268189297&'+url_data); $('#voucher_preview_image').attr('src', 'http://www.moneyoffvouchers.net/ajax_generate_voucher_image.php?date=1268189297&'+url_data); } function update_voucher_image(){ var url_data = '&line1='+$('#line1').val(); url_data += '&line2='+$('#line2').val(); url_data += '&description='+$('#description').val().replace(/\n/g, "||"); url_data += '&template=3'; url_data += '&code='+$('#code').val(); url_data += '&start_date='+$('#start_date').val(); url_data += '&expiry_date='+$('#expiry_date').val(); url_data += '&bid='+$('#bid').val(); if($('#use_business_logo:checked').is(':checked')){ url_data += '&use_business_logo=y'; }else{ url_data += '&use_business_logo=n'; } url_data += '&image_library_id='+$('#image_library_id').val(); url_data += '&image_library_src='+$('#image_library_src').val(); url_data += '&authorized_by='+$('#authorized_by').val(); nob = $(".placeid:checked").length; url_data += '&nob='+nob; $('#voucher_preview').html(''); } function choose_business(business_id){ $('#bid').val(business_id); generate_voucher_prev_url(); } function filter_library_images(filterValue){ if(filterValue.length>0){ $(".image_library_div").css("display", "block") .filter(function (index) { return $(this).attr("name").indexOf(filterValue) == -1; }) .css("display", "none"); }else{ $(".image_library_div").css("display", "block"); } } function use_uploaded_image(){ if(selected_image_from_library>0){ $('#image_library_div_'+selected_image_from_library).css('border-color', '#ffffff'); } $('#voucher_logo_preview').html(''); $('#image_library_id').val('0'); $('#image_library_src').val(''); $('#use_business_logo:checked').attr('checked', false); generate_voucher_prev_url(); } function select_use_business_logo(){ if(selected_image_from_library>0){ $('#image_library_div_'+selected_image_from_library).css('border-color', '#ffffff'); } $('#voucher_logo_preview').html(''); $('#image_library_id').val('0'); $('#image_library_src').val(''); generate_voucher_prev_url(); } function select_image_from_library(imageId, imageSrc){ if(selected_image_from_library>0){ $('#image_library_div_'+selected_image_from_library).css('border-color', '#ffffff'); } $('#image_library_div_'+imageId).css('border-color', '#F8AD3A'); selected_image_from_library = imageId; $('#voucher_logo_preview').html(''); $('#use_business_logo:checked').attr('checked', false); $('#image_library_id').val(imageId); $('#image_library_src').val(imageSrc); generate_voucher_prev_url(); } function prev_img(){ $('#preview').html('Loading voucher preview...'); var url_data = 'line1='+$('#line1').val(); url_data += '&line2='+$('#line2').val(); url_data += '&description='+$('#description').val(); url_data += '&template=3'; url_data += '&code='+$('#code').val(); url_data += '&expiry_date='+$('#expiry_date').val(); $.ajax({ type: "POST", url: "/ajax_generate_voucher_image.php", data: url_data, success: function(msg){ $('#preview').html(''); } }); } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } function prepareInputsForHints() { var inputs = document.getElementsByTagName("input"); for (var i=0; i limit){ document.getElementById(field).value = document.getElementById(field).value.substring(0, limit); } if(span_field.length > 0){ txt = ""; left_chars = limit - document.getElementById(field).value.length; txt = "Left " + left_chars + " chars of " + limit + ""; document.getElementById(span_field).innerHTML = txt; } } function check_email(email){ Wzor = /^[0-9a-zA-Z.-_\-]+\@[0-9a-zA-Z.-_\-]+\.[0-9a-zA-Z.]{2,4}$/; if (Wzor.test(email) == false){ return false; } else { return true; } } window_id = ''; function show_image(url){ var divId = createNewWindow(500,500,0,0); window_id = divId; var txt = ''; document.getElementById('windowContent' + divId).innerHTML = txt; } function _change_password(){ if (document.getElementById("password").disabled){ document.getElementById("password").disabled = false; document.getElementById("password2").disabled = false; } else { document.getElementById("password").disabled = true; document.getElementById("password2").disabled = true; } } function findPosX(obj) { var curleft = 0; if (obj.offsetParent) { while (1) { curleft+=obj.offsetLeft; if (!obj.offsetParent) { break; } obj=obj.offsetParent; } } else if (obj.x) { curleft+=obj.x; } return curleft; } function findPosY(obj) { var curtop = 0; if (obj.offsetParent) { while (1) { curtop+=obj.offsetTop; if (!obj.offsetParent) { break; } obj=obj.offsetParent; } } else if (obj.y) { curtop+=obj.y; } return curtop; } function show_hide_element(id){ h = document.getElementById(""+id+""); h.style.display = (h.style.display == "none") ? "block" : "none"; } function submit_search_form(source){ if (source == 1){ txt = document.getElementById('search_txt'); document.location.href = 'http://www.moneyoffvouchers.net/search/'+txt.value+'|1|1'; } else if (source == 2){ txt = document.getElementById('search_txt2'); if (document.getElementById('search_artist').checked || document.getElementById('search_fan').checked){ var art = (document.getElementById('search_artist').checked) ? "1" : "0"; var fan = (document.getElementById('search_fan').checked) ? "1" : "0"; document.location.href = 'http://www.moneyoffvouchers.net/search/'+txt.value+'|'+art+'|'+fan+''; } else { alert('Please indicate what type of users you are looking for'); } } } function lightup(imageobject, opacity){ if (navigator.appName.indexOf("Netscape")!=-1 && parseInt(navigator.appVersion)>=5){ if (imageobject.style.MozOpacity){ imageobject.style.MozOpacity=opacity/100; } else if (imageobject.style.opacity){ imageobject.style.opacity=opacity/100; } } else if (navigator.appName.indexOf("Microsoft")!= -1 && parseInt(navigator.appVersion)>=4){ imageobject.style.filter="alpha(opacity="+opacity+")"; } } function show_description(elid, action){ if(action=="show"){ var obj = document.getElementById(elid); if (obj) obj.style.display = "none"; var obj1 = document.getElementById("l"+elid); if (obj1) obj1.style.display = "block"; }else{ var obj = document.getElementById(elid); if (obj) obj.style.display = "block"; var obj1 = document.getElementById("l"+elid); if (obj1) obj1.style.display = "none"; } } function save_quote(id){ var url = 'http://www.moneyoffvouchers.net/ajax_save_quote.php?product='+id+''; new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { if (transport.responseText.match('ok')){ //alert('ok'); } else { //alert('no'); } } }); }