﻿// JScript File

function Send(culture){
                ClearError1();
                var name = document.getElementById('fm_name').value;
                var subject = document.getElementById('fm_subject').value;
                var email = document.getElementById('fm_email').value;
                var message = document.getElementById('fm_message').value;
                Webservice.SendInquiry(name, subject, email, message, culture, GetCallback1, ErrorCall1);
                return false;
            }

function ClearError1()
            {
                var errorLabel = document.getElementById('errorLabel');
                errorLabel.innerHTML = '';
            }   
            
function ErrorCall1(args)
            {
                var errorLabel = document.getElementById('errorLabel');
                errorLabel.innerHTML =  args.get_message();
            }            
            
            
 function GetCallback1(result, userContext, methodName)
            {    
                document.getElementById('divcontrols').style.visibility = "hidden";
                var resultLabel = document.getElementById('resultLabel');
                //tracking code
                var pagetitle = document.title; //INSERT CUSTOM PAGE NAME IN QUOTES
                var action = "INQUIRY"; //ACTION CODE
                var amount = "0"; //ACTION AMOUNT (LEAVE BLANK OR 0 IF NO AMOUNT)
                var order = document.getElementById('fm_email').value; //INSERT UNIQUE ORDER NUMBER
                var scriptlocation = "http://www.portugal-algarve-car-hire.com/metatraffic2/track.asp";
                var pagedata = 'mtpt=' + escape(pagetitle) + '&mtac=' + escape(action) + '&mta=' + amount + '&mto=' + escape(order) + '&mtr=' + escape(document.referrer) + '&mtt=2&mts=' + window.screen.width + 'x' + window.screen.height + '&mti=1&mtz=' + Math.random(); 
                var trackingcode = '<img height="1" width="1" src="' + scriptlocation + '?' + pagedata + '"><noscript><a href="http://www.snapacar.eu/" target="_blank"><img src="http://www.portugal-algarve-car-hire.com/metatraffic2/track.asp?mtt=2&mti=1" alt="website statistics" border=0></a></noscript>';
                //
                resultLabel.innerHTML = result + trackingcode;
            }                           



 if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();
