﻿function jsFlashEventNotifier(action, type, name, args)
{    
    try
    {                   
        switch (action.toString().toLowerCase())		
	    {
		    case "eventsavedproduct":
				if (typeof RaiseOrderFromWebbasketLineNo == 'function')
				{
					RaiseOrderFromWebbasketLineNo(args);
				}
				 break;
		    case "eventbuttonclicked":
//		        alert("Control Type: " + type + "\r\nButton Name: " + name + "\r\nArguments: " + args);
//		        CImageButtonTestJS(type,name,args);
		        break;
		    default:
			     debugAlert(action.toString().toLowerCase());
		        break;
        }
    }
    catch(eventEx)
    {
        // I will display an alert for now, but maybe this ought to send some stuff to the server through AJAX and do some logging
        alert("There was an error when grabbing event " + action + "\r\n\r\n" + eventEx.toString());        
    }
}

function CImageButtonTestJS(type, name, arguments)
{    
    // Try catches are a must here! if for any reason a call fails, subsequent javascript won't execute!
    try
    {
        //alert("Direct Test\r\nControl Type: " + type + "\r\n:Button Name " + name + "\r\nArguments: " + arguments);        
    }
    catch(eventEx)
    {
        // I will display an alert for now, but maybe this ought to send some stuff to the server through AJAX and do some logging
       // alert("There was an error when grabbing event " + name);        
    }
    
}