﻿// JScript File

var h,w;
var div;
    function fnMove(event,divTst,Instruction)
    {
            var hidName=Instruction.id;
            var regEx = new RegExp ('lbInstructions', 'gi');
            hidName = hidName.replace(regEx, 'hidInstruction');
            var hidControl = document.getElementById(hidName);
           //document.getElementById("lblInstructionDisplay").innerText = hidControl.value;
           divTst.style["display"] = "";
           divTst.innerHTML = '<table height=100% width=100%><tr align=center><td valign=middle>' + hidControl.value + '</td></tr></table>' ;
           divTst.style["left"]=event.clientX - 150 ;
           divTst.style["top"]=event.clientY + 25 ;
           //divTst.style["left"]=event.clientX - 300;
           //divTst.style["top"]=event.clientY - 100;
           w=0;
//           h=0;
//           divTst.style["width"]=w;
//           divTst.style["height"]=h;
           //userDrawLine(); 
            div=divTst;
           fnInSize();
    }
    function fnOut(event,divTst)
    {
           divTst.style["display"] = "None";
               }
    
    
    function fnInSize()
    {
          w=w+5;
//          h=h+5;
//           div.style["width"]=w;
//           div.style["height"]=h;
           div.style.filter= 'alpha(opacity='+ w +')';
           if(w>100)
           {
            clearTimeout(timerID);
            timerID =0;
           }
           else
            timerID = setTimeout("fnInSize()", 1);
    }
    
    
       function userDrawLine()
        {
           
           var jg = new jsGraphics("divTest");
            jg.setColor("#008800");
            var Xpoints = new Array(0,200,200,250,200,200,0);
            var Ypoints = new Array(0,0,10,100,75,200,200);

            jg.fillPolygon(Xpoints, Ypoints);

            //jg.setStroke(3); 
            //jg2.drawLine(0, 0, 500, 800);  
            //jg.fillRect(0, 0, 160, 100);
            //jg.fillEllipse(20,50,100,100)
            jg.paint();    
        }
        
        
        
        
//function StartTime()
//{

//var lblStartTime = document.getElementById(<% lblSartTime %>);
//var hidExamTime = document.getElementById("hidExamTime");
//var lblRemainingTime = document.getElementById("lblRemainingTime");
//var lblCurrentTime = document.getElementById("lblCurrentTime");

//if (lblStartTime!= null && hidExamTime != null && lblRemainingTime != null && lblCurrentTime != null)
//{
//    alert("sandip");
//    var d = new Date();
//    lblStartTime.innerText = d;
//}
//}




function OnLoadResize(panelbar)
{
    //var panelbar = ;
    //alert(panelbar);
}



function PaneResize(sender, eventArgs)
    {
        //alert(pane);
        //pane.ExpandedItem=pane.Items[0];
        //.Expanded=true;
    }
    
    
    function AllowNumericOnly(ctrl,allowDecimal,e)
    {
        if(window.event)
        {
            //Handel Decimal Point
            if(event.keyCode == 46)
            {
                if(!allowDecimal) return false;
                else
                { // Allow only Single "." only
                    if(ctrl.value.indexOf('.') == -1)
                    {
                        if(ctrl.value == "") ctrl.value = "0";
                        return true;
                    }
                    else return false;
                }
            } //Handel Numerics
            else if (48 <= event.keyCode && event.keyCode <= 57)
            {
                return true;
            }
            else
                return false;
        }
        else
        {
                //Handel Decimal Point
                if(e.which == 46)
                {
                    if(!allowDecimal) return false;
                    else
                    { // Allow only Single "." only
                        if(ctrl.value.indexOf('.') == -1)
                        {
                            if(ctrl.value == "") ctrl.value = "0";
                            return true;
                        }
                        else return false;
                    }
                } //Handel Numerics
                else if (48 <= e.which && e.which <= 57)
                {
                    return true;
                }
                else
                    return false;            
        }
    }
    
    function CalculateTotalDays()
    {   
        if(txtYears != null && txtMonths != null && txtWeeks != null && txtDays != null)
        {   
            var intDays = parseInt(txtDays.value);
            if(isNaN(intDays)) intDays=0;
            
            var intWeeks = parseInt(txtWeeks.value);
            if(isNaN(intWeeks)) intWeeks=0;
            
            var fltMonths = parseFloat(txtMonths.value);
            if(isNaN(fltMonths)) fltMonths=0;
            
            var fltYears = parseFloat(txtYears.value);
            if(isNaN(fltYears)) fltYears=0;
            
            var totalDays = intDays + (intWeeks*7) + (fltMonths*30) + (fltYears*365);
            
            lblTotalDays.innerHTML = totalDays;
            hidPeriod.value = totalDays;
        }
    }
  
    function xlaAFMlaunch(type){
	    xlaAFMopenwindow(type,'','','');
    }

    function xlaAFMopenwindow(type, faqid,topicid,question){
	    if (document.all) {
		    windowheight = screen.availHeight;
		    windowwidth=screen.availWidth;
		    rightwidth=300;
		    leftwidth=screen.availWidth-rightwidth-11;
		    AFMwindow=window.open('http://'+type+'.trainerware.com/afmmain.aspx?topicid=' + topicid + '&faqid=' + faqid + '&question=' + question ,'xlaAFM','width='+rightwidth+',height='+windowheight+',screenX='+leftwidth+',screenY=0,top=0,left=' +leftwidth+',toolbar=0,location=0,status=1,menubar=0,resizable=1');
		    AFMwindow.focus();
    		
		    // Resize Current Window //
		    top.resizeTo(leftwidth,windowheight);
		    top.moveTo(0,0);
		    top.focus();
	    } else {
		    AFMwindow=window.open('http://'+type+'.trainerware.com/afmmain.aspx?topicid=' + topicid + '&faqid=' + faqid + '&question=' + question  ,'','width=300,height=480,toolbar=0,location=0,status=1,menubar=0,resizable=1');
	    }	  
	      
	    return false;
    }