
function flmpsendmailtofriend(mailtofriend) {
    var req;

    this.process = function() { }

    if(window.XMLHttpRequest) {
	try {
    	    this.req = new XMLHttpRequest();
	} catch(e) {
    	    this.req = false;
	}
    } else if(window.ActiveXObject) {
	try {
    	    this.req = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
	    try {
    		this.req = new ActiveXObject("Microsoft.XMLHTTP");
	    } catch(e) {
               this.req = false;
    	    }
	}
    }
    if(this.req) {
        this.req.onreadystatechange = this.process;
        url = "/" + channelName + "/index.php?module=sendtofriend&fromAddress=" + mailtofriend.getFromAddress() + "&toAddress=" + mailtofriend.getToAddress() + "&message=" + mailtofriend.getMessage();
        this.req.open("GET", url, true);
        this.req.send("");
    }
}

	
        function receiveResponse(errorFromFlmp) {
//            alert("flmp_webpage.htm::receiveResponse::is called"+errorFromFlmp._typeOfError);
//            alert("flmp_webpage.htm::receiveResponse::is called"+errorFromFlmp._errorDescription);
        }
        function onSilverlightError(sender, args) {
            var appSource = "";
            if (sender != null && sender != 0) {
                appSource = sender.getHost().Source;
            } 
            var errorType = args.ErrorType;
            var iErrorCode = args.ErrorCode;
            
            var errMsg = "Unhandled Error in Silverlight 2 Application " +  appSource + "\n" ;

            errMsg += "Code: "+ iErrorCode + "    \n";
            errMsg += "Category: " + errorType + "       \n";
            errMsg += "Message: " + args.ErrorMessage + "     \n";

            if (errorType == "ParserError")
            {
                errMsg += "File: " + args.xamlFile + "     \n";
                errMsg += "Line: " + args.lineNumber + "     \n";
                errMsg += "Position: " + args.charPosition + "     \n";
            }
            else if (errorType == "RuntimeError")
            {           
                if (args.lineNumber != 0)
                {
                    errMsg += "Line: " + args.lineNumber + "     \n";
                    errMsg += "Position: " +  args.charPosition + "     \n";
                }
                errMsg += "MethodName: " + args.methodName + "     \n";
            }
            //throw new Error(errMsg);
        }

	function flmpReportError(errorNo ) {
	    //alert(errorNo);
	}
	
	function displaySilverlightBox() {
	    document.write('<div style="display: block; position: absolute; background: black; opacity: 0.7; -moz-opacity: 0.7; -khtml-opacity: 0.7; filter: alpha(opacity=40); width: 100%; height: 100%; top: 0px; left: 0px; z-index: 100;" id="silverlightBackground"></div>');
	    document.write('<iframe style="display: none; z-index: 100; filter:alpha(opacity=100);-moz-opacity:1;opacity:1;position: absolute; left: 100px; top: 10px; float: none;" id="silverlightIntro" src="/data/html/installation.html" width="650" height="400" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" valign="top"></iframe>');
	    ResizeEvent();
	    window.onresize = ResizeEvent;	    
	    checkSilverlight();
	}

	function ResizeEvent() {
	    var s = document.getElementById('silverlightIntro');
	    var x = document.getElementById('silverlightBackground');
	    var w;	
	    var h;

	    if(typeof(window.innerWidth) == 'number') {
		w = window.innerWidth;
		h = window.innerHeight;
	    } else if( document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		w = document.documentElement.clientWidth;
		h = document.documentElement.clientHeight;
	    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		w = document.body.clientWidth;
		h = document.body.clientHeight;
	    }

	    s.style.top = h/2 - 200 + "px";
	    s.style.left = w/2 - 333 + "px";
	    	    
	    s.style.display = "block";
	    
	    x.style.width = w + 20 + "px";
	    x.style.height = h + "px";
	    
	    window.document.body.style.overflowX = "hidden";
	    window.document.body.style.overflowY = "hidden";
	    
	}
	function checkSilverlight() {
	    if(Silverlight.isInstalled("2.0")) {
		hideSilverlightBox();
	    } else {
		setTimeout("checkSilverlight()", 333);
	    }
	}
	
	function hideSilverlightBox() {
	    window.location.href=window.location.href;
	}
