﻿// JScript File

var path;
var frameW;
var frameH

function loadCalcultorFrame(CalcID, CalcName, frameWidth, frameHeight, wsUrl)
{    
    //path = "http://10.0.0.7:85/HashavimCalcs/"+CalcName;
    path = wsUrl + "/" + CalcName;
    frameW = frameWidth;
    frameH = frameHeight;
    
    GetCalcCode(CalcID);
}

//function loadCalcultorFrame(CalcName, frameWidth, frameHeight)
//{
//    //document.frames["calcFrame"].frameElement.className = "ShowRegMessage";
//    //document.getElementById("divCalcsIntroduction").className = "HideRegMessage";
//    var path = "http://10.0.0.7:85/HashavimCalcs/"+CalcName;
//    //var path = "http://10.0.0.7:85/HashavimCalcs/"+CalcName ;           
//    document.getElementById("ctl00_MasterHashavimGiu_calcFrame").src = path;
//    document.getElementById("ctl00_MasterHashavimGiu_calcFrame").style.width = frameWidth;
//    document.getElementById("ctl00_MasterHashavimGiu_calcFrame").style.height = frameHeight;
//}

function GetCalcCode(calculatorID)
{
    InternalService.GetCalculatorCode(calculatorID, OnGetCalcCode, OnError);
}

function OnGetCalcCode(args)
{
    //var frameId = "ctl00_ContentPlaceHolder1_frmCalc";
    var frameId = "ctl00_MasterHashavimGiu_calcFrame";

    document.getElementById(frameId).src = path + "?cc=" + args;
    document.getElementById(frameId).style.width = frameW;
    document.getElementById(frameId).style.height = frameH;
}

function OnError(args)
{
    alert(args._message);
}