document.write('<script type="text/javascript" src="http://www.ampminsure.org/include/js/movable-win.js"></script>');

function showCalculatordiv(CalculatorType)
{                                                            
        var IframeObj = document.getElementById('CalculatorInfoIFrame');
        IframeObj.src ='http://www.ampminsure.org/calculators/'+CalculatorType+'.html';
        setTimeout("winList['CalculatorWindow'].open()", 500);
}

function FnShowInitialTableForCalculatorForm(CalculatorLink)
{
        var InitialTable = '';
        var IframeCode = '<IFRAME id="CalculatorInfoIFrame" src="" scrolling="auto" frameborder="0" width="100%" height="100%"></IFRAME>';
        var WindowHTMLCode = '<div id="CalculatorWindow" class="window" style="left: 219px; z-index: 6; width: 597px; visibility:hidden;" align="left">';
        WindowHTMLCode += '<div style="" class="titleBar">';
        WindowHTMLCode += '<span style="" class="titleBarText">Insurance Calculator.</span>';
        WindowHTMLCode += '<span style=""><img class="titleBarButtons" alt="" src="http://www.ampminsure.org/styles/apin/img/nav-button.gif" usemap="#MiniForumMap">';
        WindowHTMLCode += '<map id="MiniForumMap" name="MiniForumMap">';
        WindowHTMLCode += '<area shape="rect" coords="0,0,15,13" href="" alt="" title="Minimize" onclick="this.parentWindow.minimize();return false;">';
        WindowHTMLCode += '<area shape="rect" coords="16,0,31,13" href="" alt="" title="Restore" onclick="this.parentWindow.restore();return false;">';
        WindowHTMLCode += '<area shape="rect" coords="34,0,49,13" href="" alt="" title="Close" onclick="this.parentWindow.close();return false;">';
        WindowHTMLCode += '</map></span></div>';
        WindowHTMLCode += '<div id="ShowTopicInfo" class="clientArea" style="top:30px; height:500px" >'+IframeCode+'</div>';
        WindowHTMLCode += '</div>';


        if(CalculatorLink =='http://www.ampminsure.org/')
        {
                
                InitialTable += '<table border="'+BorderWidth+'" cellspacing="0" cellpadding="5"  bordercolor="'+BorderColor+'" width="'+BoxWidth+'" height="'+BoxHeight+'">';
                InitialTable += '<tr><td valign="top" width="" height="" bgcolor="'+BackGroundColor+'" class="ampmmessagetext">';
                InitialTable += "<span style='font-size:"+HeadingFontSize+"; font-weight: bold; color:"+HeadingFontcolor+";'>"+HeadingText+"</span><ul><li><a href=\"javascript:showCalculatordiv('disability')\" >Disability Insurance Calculator</a></li><li><a href=\"javascript:showCalculatordiv('sports')\" >Sports Injury Calculator</a></li><li><a href=\"javascript:showCalculatordiv('bodymass')\" >Body Mass Index Calculator</a></li><li><a href=\"javascript:showCalculatordiv('life')\" >Life Insurance Calculator</a></li></ul>";
                InitialTable += '</td></tr></table>'+WindowHTMLCode;

                document.getElementById('CalculatorBoardBox').innerHTML = InitialTable;
       }
        else
        {
                document.getElementById('CalculatorBoardBox').innerHTML = 'Oops, Either the code has changed or it is manipulated at your end. Please get the code again from <a href="http://www.ampminsure.org/syndication/calculators.html">AmpmInsure.</a>';
        }
}
function FnInitialiseCSSAndShowInitialTableForCalculatorForm()
{
       var CalculatorLinkInArray = explode(document.getElementById('CalculatorLink'),"/");   
       var CalculatorLink=CalculatorLinkInArray[0]+"//"+CalculatorLinkInArray[2]+"/"; 
                                        
       FnShowInitialTableForCalculatorForm(CalculatorLink);
}
FnInitialiseCSSAndShowInitialTableForCalculatorForm();

/* This function will explode the string in to array. */

function explode(inputstring, separators, includeEmpties) {
                inputstring = new String(inputstring);
                separators = new String(separators);

                if(separators == "undefined") {
                separators = " :;";
                }

                fixedExplode = new Array(1);
                currentElement = "";
                count = 0;

                for(x=0; x < inputstring.length; x++) {
                char = inputstring.charAt(x);
                if(separators.indexOf(char) != -1) {
                if ( ( (includeEmpties <= 0) || (includeEmpties == false)) && (currentElement == "")) { }
                else {
                fixedExplode[count] = currentElement;
                count++;
                currentElement = ""; } }
                else { currentElement += char; }
                }

                if (( ! (includeEmpties <= 0) && (includeEmpties != false)) || (currentElement != "")) {
                fixedExplode[count] = currentElement; }
                return fixedExplode;
}
