﻿
var ReturnPage = null;
var UserSelected = false;
var MouseX = 0;
var MouseY = 0;

// Restituisce un Oggetto Ajax in modalità cross browser
function GetAjaxObject() 
{
	var oAjax = null;
	var UserBrowser = navigator.userAgent.toUpperCase();
	
	if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
	{
		oAjax = new XMLHttpRequest();
	}else if(window.ActiveXObject && UserBrowser.indexOf("MSIE 4") < 0) 
	{
	  if(UserBrowser.indexOf("MSIE 5") < 0)
	  {
			oAjax = new ActiveXObject("Msxml2.XMLHTTP");
		}else{
			oAjax = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return oAjax;
}

// Apertura del Carrello
function InizializzaCarrello(EndPage)
{
    ReturnPage = EndPage;
    var oDIV = document.getElementById('ModuloCarrello');
    
    // Oggetto Ajax
    var oAjax = GetAjaxObject()            
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
			    oDIV.innerHTML = oAjax.responseText;
		    }
	    }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=GetList&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);      
}

// Esegue una Chiamata Ajax al Server per aggiungere un articolo al carrello
function Add(Code)
{
    var oAjax = GetAjaxObject()            
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
		        var Response = oAjax.responseText.split('|');
		        document.getElementById('DivInfoItem').style.top = MouseY;
		        document.getElementById('DivInfoItem').style.left = MouseX;
		        document.getElementById('DivInfoItem').style.visibility = 'visible';
		        document.getElementById('SpanInfoHeader').innerHTML = Response[0];
		        document.getElementById('SpanInfoItem').innerHTML = Response[1];
		        window.setTimeout('HideDiv()', 2000);
		    }
	    }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=Add&Code=' + Code + '&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);  
}

function AddQuantity(Code)
{
    // Oggetto Ajax
    var oAjax = GetAjaxObject()            
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
			    if(oAjax.responseText == Code)
			    {
			        InizializzaCarrello();
			    }else{
			        window.alert('Impossibile aumentare la quantita\' per questo articolo');
			    }
		    }
	    }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=AddQuantity&Code=' + Code + '&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);          
}

function RemoveQuantity(Code)
{
    
    // Oggetto Ajax
    var oAjax = GetAjaxObject()            
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
			    if(oAjax.responseText == Code)
			    {
			        InizializzaCarrello();
			    }else{
			        window.alert('Impossibile diminuire la quantita\' per questo articolo');
			    }
		    }
	    }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=RemoveQuantity&Code=' + Code + '&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);          
}


function UserData()
{
    if(UserSelected)
    {
        GetSessionUserData();
    }
    else
    {
        var oDIV = document.getElementById('ModuloCarrello');
        
        // Oggetto Ajax
        var oAjax = GetAjaxObject();
    	
        // Preparo la funzione destinata a gestire l'evento di ricezione
        oAjax.onreadystatechange = function()
        {
	        if(oAjax.readyState === 4) 
	        {
		        if(oAjax.status == 200)
		        {
			        oDIV.innerHTML = oAjax.responseText;
			        //if(!UserSelected)
					//{
						//FillNazioni();
					//}
		        }
	        }
        }			
        // Eseguo la Chiamata Ajax
        oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=GetUserDataPanel&TimeStamp=' + GetTimeStamp(), true);
        oAjax.send(null); 
    }     
}

function CheckUserData()
{
    var oDIV = document.getElementById('ModuloCarrello');
    var UserCode = document.getElementById('BoxUserCode').value;
    var Password = document.getElementById('BoxPassword').value;
    if(UserCode == '')
    {
        window.alert('Digitare il Codice Utente!');
        return;
    }
    if(Password == '')
    {
        window.alert('Digitare la Password Utente!');
        return;
    }    
    
    // Oggetto Ajax
    var oAjax = GetAjaxObject();
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
        if(oAjax.readyState === 4) 
        {
	        if(oAjax.status == 200)
	        {
	            if(oAjax.responseText == 'OK')
	            {
	                UserSelected = true;
		            GetUserData();
		        }else
		        {
	                UserSelected = false;
		            ShowMessage('UtenteNonConvalidato');
		        }
	        }
        }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=CheckUserData&UserCode=' + UserCode + '&Password=' + Password + '&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);  
}

function GetUserData()
{
    var oDIV = document.getElementById('ModuloCarrello');
    var UserCode = document.getElementById('BoxUserCode').value;
    var Password = document.getElementById('BoxPassword').value;
    if(UserCode == '')
    {
        window.alert('Digitare il Codice Utente!');
        return;
    }
    if(Password == '')
    {
        window.alert('Digitare la Password Utente!');
        return;
    }    
    
    // Oggetto Ajax
    var oAjax = GetAjaxObject();
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
        if(oAjax.readyState === 4) 
        {
	        if(oAjax.status == 200)
	        {
	            UserSelected = true;
		        oDIV.innerHTML = oAjax.responseText;
	        }
        }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=GetUserData&UserCode=' + UserCode + '&Password=' + Password + '&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);  
}

function GetSessionUserData()
{

    var oDIV = document.getElementById('ModuloCarrello');
    
    // Oggetto Ajax
    var oAjax = GetAjaxObject();
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
			    oDIV.innerHTML = oAjax.responseText;
		    }
	    }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=GetSessionUserData&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);      
}

function SaveUserData()
{
    var oDIV = document.getElementById('ModuloCarrello');
    var Email = document.getElementById('BoxUserCode').value;
    if(Email == ''){ ShowMessage('ObbligoInserimentoEmail'); return; }    
    var Password = document.getElementById('BoxPassword').value;
    if(!UserSelected){if(Password == ''){ ShowMessage('ObbligoInserimentoPassword'); return; }}    
    var Nome = document.getElementById('BoxNome').value;
    if(Nome == ''){ ShowMessage('ObbligoInserimentoNome'); return; }
    var Cognome = document.getElementById('BoxCognome').value;
    if(Cognome == ''){ ShowMessage('ObbligoInserimentoCognome'); return; }
    var RagioneSociale = document.getElementById('BoxRagioneSociale').value;
    var CFPIVA = document.getElementById('BoxCFPIVA').value;
    //if(CFPIVA == ''){ ShowMessage('ObbligoInserimentoCFPIVA'); return; }
	/*
    var Nazione = document.getElementById('CmbNazioni').options[document.getElementById('CmbNazioni').selectedIndex].value;
	if(document.getElementById('CmbNazioni').options[document.getElementById('CmbNazioni').selectedIndex].value == 'NN'){ ShowMessage('ObbligoInserimentoRegione'); return; }
    var Regione = document.getElementById('CmbRegioni').options[document.getElementById('CmbRegioni').selectedIndex].value;
	if(document.getElementById('CmbRegioni').options[document.getElementById('CmbRegioni').selectedIndex].value == 'NN'){ ShowMessage('ObbligoInserimentoRegione'); return; }
    var Provincia = document.getElementById('CmbProvincie').options[document.getElementById('CmbProvincie').selectedIndex].value;
	if(document.getElementById('CmbProvincie').options[document.getElementById('CmbProvincie').selectedIndex].value == 'NN'){ ShowMessage('ObbligoInserimentoRegione'); return; }
    var Comune = document.getElementById('CmbComuni').options[document.getElementById('CmbComuni').selectedIndex].text;
	if(document.getElementById('CmbComuni').options[document.getElementById('CmbComuni').selectedIndex].value == 'NN'){ ShowMessage('ObbligoInserimentoRegione'); return; }
    var Localita = document.getElementById('BoxLocalita').value;
    var Indirizzo = document.getElementById('BoxIndirizzo').value;
    if(Indirizzo == ''){ ShowMessage('ObbligoInserimentoIndirizzo'); return; }
	*/
	var NumeroCivico = document.getElementById('BoxNumeroCivico').value;
	var Citta = document.getElementById('BoxCitta').value;
	var Provincia = document.getElementById('BoxProvincia').value;
	if (NumeroCivico == '') { ShowMessage('ObbligoInserimentoIndirizzo'); return; }
    if (Citta == '') { ShowMessage('ObbligoInserimentoIndirizzo'); return; }
	if (Provincia == '') { ShowMessage('ObbligoInserimentoIndirizzo'); return; }
	var CAP = document.getElementById('BoxCap').value;
	if (CAP == ""){ ShowMessage('ObbligoInserimentoCanale'); return; }
    var Telefono = document.getElementById('BoxTelefono').value;
    var Fax = document.getElementById('BoxFax').value;
    var Cellulare = document.getElementById('BoxCellulare').value;
    //if(Telefono == '' && Fax == '' && Cellulare == ''){ ShowMessage('ObbligoInserimentoCanale'); return; }
    var Annotazioni = document.getElementById('BoxAnnotazioni').innerHTML;
    var Privacy = document.getElementById('ChkPrivacy').checked;
    if(!Privacy){ ShowMessage('ObbligoConfermaPrivacy'); return; }
    
    // Oggetto Ajax
    var oAjax = GetAjaxObject();
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
			    oDIV.innerHTML = oAjax.responseText;
		    }
	    }
    }			
    var URL = VirtualRoot + 'Store/StoreService.aspx?Op=SaveUserData';
    URL += ('&Nome=' + Nome);
    URL += ('&Cognome=' + Cognome);
    URL += ('&RagioneSociale=' + RagioneSociale);
    URL += ('&CFPIVA=' + CFPIVA);
	/*
    URL += ('&Nazione=' + Nazione);
    URL += ('&Regione=' + Regione);
    URL += ('&Provincia=' + Provincia);
    URL += ('&Comune=' + Comune);
	URL += ('&Localita=' + Localita);
    URL += ('&Indirizzo=' + Indirizzo);
	*/
	URL += ('&NumeroCivico=' + NumeroCivico);
	URL += ('&Citta=' + Citta);
	URL += ('&Provincia=' + Provincia);
    URL += ('&CAP=' + CAP);
    URL += ('&Telefono=' + Telefono);
    URL += ('&Fax=' + Fax);
    URL += ('&Cellulare=' + Cellulare);
    URL += ('&Email=' + Email);
    URL += ('&Password=' + Password);
    URL += ('&Annotazioni=' + Annotazioni);
    // Eseguo la Chiamata Ajax
    oAjax.open('get', URL, true);
    oAjax.send(null);      
}

function SendOrder()
{
    // Oggetto Ajax
    var oAjax = GetAjaxObject();
    var PaymentOption = GetPaymentOptions();
    if(PaymentOption == 'none')
    {
        ShowMessage('ObbligoSelezionePagamento');
        return;
    }
    var PaymentNotes = document.getElementById('BoxAnnotazioniOrdine').innerText;
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
			    if(oAjax.responseText == "OK")
			    {
			        EndBuy();
			    }else{
			        ShowMessage('OrdineNonConcluso');
			    }
		    }
	    }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=SaveOrder&PaymentOption=' + PaymentOption + '&PaymentNotes=' + PaymentNotes + '&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null); 
}

function EndBuy()
{
    // Oggetto Ajax
    var oAjax = GetAjaxObject();
    
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
		        window.location = oAjax.responseText;
		    }
	    }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=GetReturnPage&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null); 
}

function GetPaymentOptions()
{
    var OptionPag = 'none';
	for (itag=0; itag<document.all.length; ++itag) 
	{ 
		if(document.all(itag).id.indexOf("OptPag") > 0)
		{
			try
			{
			    if(document.all(itag).checked)
			    {
			        OptionPag = document.all(itag).id;
			        return OptionPag;
			    }
			}catch(e){}	
   		}   		
    } 
    return OptionPag;
}

function ClearOptions(SelectControl)
{
    while(SelectControl.options.length > 0)
    {
        SelectControl.options.remove(0);
    }
}

/*function FillNazioni()
{
    // Oggetto Ajax
    var oAjax = GetAjaxObject();
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
                var oList = document.getElementById('CmbNazioni');		    
		        ClearOptions(oList);
			    var List = oAjax.responseText;
			    var ArrayList = List.split("|");
			    var Voice = "";
			    for(I = 0; I < ArrayList.length; I++)
			    {
			        Voice = ArrayList[I].split(";");
			        oList.options[I] = new Option(Voice[1], Voice[0]);
			    }
			    FillRegioni(oList.options[oList.selectedIndex].value);
		    }
	    }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=GetNazioni&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);          
}

function FillRegioni(Nazione)
{
    // Oggetto Ajax
    var oAjax = GetAjaxObject();
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
                var oList = document.getElementById('CmbRegioni');		    
		        ClearOptions(oList);
			    var List = oAjax.responseText;
			    var ArrayList = List.split("|");
			    var Voice = "";
				oList.options[I] = new Option('Seleziona', 'NN');
			    for(I = 0; I < ArrayList.length; I++)
			    {
			        Voice = ArrayList[I].split(";");
			        oList.options[I] = new Option(Voice[1], Voice[0]);
			    }
			    FillProvincie(oList.options[oList.selectedIndex].value);
		    }
	    }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=GetRegioni&Nazione=' + Nazione + '&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);          
}

function FillProvincie(Regione)
{
    // Oggetto Ajax
    var oAjax = GetAjaxObject();
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
                var oList = document.getElementById('CmbProvincie');		    
		        ClearOptions(oList);
			    var List = oAjax.responseText;
			    var ArrayList = List.split("|");
			    var Voice = "";
			    for(I = 0; I < ArrayList.length; I++)
			    {
			        Voice = ArrayList[I].split(";");
			        oList.options[I] = new Option(Voice[1], Voice[0]);
			    }
			    FillComuni(oList.options[oList.selectedIndex].value);
		    }
	    }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=GetProvincie&Regione=' + Regione + '&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);          
}

function FillComuni(Provincia)
{
    // Oggetto Ajax
    var oAjax = GetAjaxObject();
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
                var oList = document.getElementById('CmbComuni');		    
		        ClearOptions(oList);
			    var List = oAjax.responseText;
			    var ArrayList = List.split("|");
			    var Voice = "";
				// oList.options[I] = new Option('Seleziona', 'NN');
			    for(I = 0; I < ArrayList.length; I++)
			    {
			        Voice = ArrayList[I].split(";");
			        oList.options[I] = new Option(Voice[1], Voice[0]);
			    }
				//modificato su richiesta di mariella
			    //document.getElementById('BoxCap').value = oList.options[oList.selectedIndex].value;
		    }
	    }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=GetComuni&Provincia=' + Provincia + '&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);          
}
// Funzione di settaggio automatico del CAP in funzione del comune selezionato (disattivata su richiesta di Mariella)
function SetCAP()
{
    //document.getElementById('BoxCAP').value = document.getElementById('CmbComuni').options[document.getElementById('CmbComuni').selectedIndex].value;
}

function InizializzaRicerca(ItemCode)
{
    var oDIV = document.getElementById(ItemCode);
    
    // Oggetto Ajax
    var oAjax = GetAjaxObject()            
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
			    oDIV.innerHTML = oAjax.responseText;
		    }
	    }
    }			
    
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=GetFinder&Template=' + ItemCode + '&width=' + oDIV.style.width + '&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null); 
}
*/

function StartFinder(Template)
{
    // Leggo i dati impostati dall'Utente per la Ricerca
    var Elements = document.getElementsByTagName("body")[0].getElementsByTagName("*");
    var FinderData = "";
    for (var Index = 0; Index < Elements.length; Index++) 
    {
        if (Elements[Index].id)
        {
            if (Elements[Index].name == Template)
            {
                FinderData = FinderData + Elements[Index].id + ';' + document.getElementById(Elements[Index].id).value + '|';
            }
        }
    }
    FinderData = FinderData.substring(0, FinderData.length - 1);

    // Oggetto Ajax
    var oAjax = GetAjaxObject()            
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
			    document.getElementById(Template).innerHTML = oAjax.responseText;
		    }
	    }
    }			    
    
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=Search&Template=' + Template + '&FinderData=' + FinderData + '&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);     
}

// Chiama il Server per avere il conteggio degli articoli sul carrello
function GetItemsCount()
{
    
    // Oggetto Ajax
    var oAjax = GetAjaxObject()            
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
        if(oAjax.readyState === 4) 
        {
            if(oAjax.status == 200)
            {
                if(document.getElementById('ItemCounter'))
                {
                    document.getElementById('ItemCounter').innerHTML = oAjax.responseText;
                    window.setTimeout('GetItemsCount()', 1000);
                }
            }
        }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=GetItemsCount&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);          
}

function ShowMessage(Code)
{

    // Oggetto Ajax
    var oAjax = GetAjaxObject();
	
    // Preparo la funzione destinata a gestire l'evento di ricezione
    oAjax.onreadystatechange = function()
    {
	    if(oAjax.readyState === 4) 
	    {
		    if(oAjax.status == 200)
		    {
			    window.alert(oAjax.responseText);
		    }
	    }
    }			
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=getmessage&Code=' + Code +'&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);      
}

function HideDiv()
{
    document.getElementById('DivInfoItem').style.visibility = 'hidden';
}

function CaptureMouse(e) 
{
    if (document.layers) 
    {
        MouseX = e.pageX;
        MouseY = e.pageY;
    } else if (document.all) 
    {
        MouseX = window.event.x + document.body.scrollLeft;
        MouseY = window.event.y + document.body.scrollTop;
    } else if (document.getElementById) 
    {
        MouseX = e.pageX;
        MouseY = e.pageY;
    }
}

function GetTimeStamp()
{
	var Digital = new Date();
	var year = Digital.getFullYear();
	var month = Digital.getMonth();
	var day = Digital.getDay();		
	var hours = Digital.getHours();
	var minutes = Digital.getMinutes();
	var seconds = Digital.getSeconds();  
	var ReturnValue = year + '-' + month + '-' + day + '-' + hours + '-' + minutes + '-' + seconds;
	return ReturnValue;
}

function CountBannerClick(BannerID, ElementID, BannerPage, BannerLink)
{
    // Oggetto Ajax
    var oAjax = GetAjaxObject();
	
    // Eseguo la Chiamata Ajax
    oAjax.open('get', VirtualRoot + 'Store/StoreService.aspx?Op=BannerClick&BannerID=' + BannerID +'&ElementID=' + ElementID + '&BannerPage=' + BannerPage + '&BannerLink=' + BannerLink + '&TimeStamp=' + GetTimeStamp(), true);
    oAjax.send(null);     
}

document.onmousemove = CaptureMouse;
window.setTimeout('GetItemsCount()', 1000);




