var defaultEmptyOK = false;
var decimalPointDelimiter = "."
// Check whether string s is empty.
function isFloat (s)

{   var i;
    var seenDecimalPoint = false;

    if (isEmpty(s))
       if (isFloat.arguments.length == 1) return defaultEmptyOK;
       else return (isFloat.arguments[1] == true);

    if (s == decimalPointDelimiter) return false;

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {
        // Check that current character is number.
        var c = s.charAt(i);

        if ((c == decimalPointDelimiter) && !seenDecimalPoint) seenDecimalPoint = true;
        else if (!isDigit(c)) return false;
    }

    // All characters are numbers.
    return true;
}



function acceptreject(quesno,rowno,crtby,shid,acceptvalue)
{
document.forms[0].tablemerged.value=quesno;
document.forms[0].mergeshid.value=shid;
document.forms[0].recid.value=rowno+'_'+crtby;
document.forms[0].rowno.value=rowno;
document.forms[0].crtby.value=crtby;
document.forms[0].mergesave.value='Y';
document.forms[0].acceptvalue.value=acceptvalue;
document.forms[0].action='mergereftab.jspx';
document.forms[0].submit();
}


function blinkIt() {
 if (!document.all) return;
 else {
   for(i=0;i<document.all.tags('blink').length;i++){
      s=document.all.tags('blink')[i];
      s.style.visibility=(s.style.visibility=='visible')?'hidden':'visible';
   }
 }
}
function dispversionrec(varquesno,rowno,tablename,instid,iterationno)
{

    versionwindow = window.open('quesreport.jspx?quesno='+varquesno+'&rowno='+rowno+'&instid='+instid+'&tablename='+tablename+'&iterationno='+iterationno,'versionwin','toolbar=no,width=600,height=550,scrollbars=yes,dependent=yes,resizable=yes');
	versionwindow.focus();
}
function dispcountryversionrec(application,countrycode,varquesno,rowno,tablename,instid,iterationno)
{
    versionwindow = window.open('/'+application+'/'+countrycode+'/quesreport.jspx?quesno='+varquesno+'&countrycode='+countrycode+'&rowno='+rowno+'&instid='+instid+'&tablename='+tablename+'&iterationno='+iterationno,'versionwin','toolbar=no,width=600,height=550,scrollbars=yes,dependent=yes,resizable=yes');
	versionwindow.focus();
}

function dispcountryIndicatorlist(application,countrycode,page,indno,actno)
{
    country = window.open('/'+application+'/'+countrycode+'/country.jspx?page=activityarea.jspx&listtype=q&activityarea='+actno+'&inum='+indno,'versionwin','toolbar=no,width=600,height=350,scrollbars=yes,dependent=yes,resizable=yes');
	country.focus();
}
function submitparentwindow(application,countrycode,page,url)
{
  var page1 = page + url;
  window.opener.document.location.href='/'+application+'/'+countrycode+'/'+page+"?"+url;

  window.opener.focus();
}

function opencountrywindow()
{
    country = window.open('country.jspx','country','toolbar=no,width=600,height=350,scrollbars=yes,dependent=yes,resizable=yes');
	country.focus();
}
function openlanguagewindow()
{
    country = window.open('language.jspx','language','toolbar=no,width=400,height=350,scrollbars=yes,dependent=yes,resizable=yes');
	country.focus();
}

function dispcountryQuestionlist(application,countrycode,page,quesno)
{
    country = window.open('/'+application+'/'+countrycode+'/country.jspx?page='+page+ '&quesno='+quesno,'versionwin','toolbar=no,width=600,height=550,scrollbars=yes,dependent=yes,resizable=yes');
	country.focus();
}


function displayrefreport(varquesno,rowno,crtby)
{
 	repwindow = window.open('report.jspx?quesno='+varquesno+'&rowno='+rowno+'&crtby='+crtby,'repwin','toolbar=no,width=600,height=550,scrollbars=yes,dependent=yes,resizable=yes');
	repwindow.focus();
}

function displaycountryrefreport(application,countrycode,varquesno,rowno,crtby)
{
    repwindow = window.open('/'+application+'/'+countrycode+'/report.jspx?quesno='+varquesno+'&rowno='+rowno+'&crtby='+crtby,'repwin','toolbar=no,width=600,height=550,scrollbars=yes,dependent=yes,resizable=yes');
	repwindow.focus();
}

function displayanswerreport(varquesno,rowno,instid)
{
 	repwindow = window.open('quesreport.jspx?quesno='+varquesno+'&rowno='+rowno+'&instid='+instid,'queswin','toolbar=no,width=600,height=550,scrollbars=yes,dependent=yes,resizable=yes');
	repwindow.focus();
}

function getstats(shid,iteration)
{

document.forms[0].stakeholders.value=shid;
document.forms[0].iterations.value=iteration;
document.forms[0].action='shstat.jspx';
document.forms[0].submit();
}

function getstat(shid,iteration)
{
 	popupwindow = window.open('shstat.jspx?stakeholders='+shid+'&iterations='+iteration+'&popup=Y','popupwin','toolbar=no,width=500,height=300,scrollbars=yes,dependent=yes,resizable=no');
	popupwindow.focus();
}
function testForEnter()
{
  if(event.keyCode==13 && event.srcElement.type=="text")
  {
    event.keyCode = 0;
    event.returnValue = false;
    return false;
  }
else
{
   return true;
}
}


function changesh()
{
document.forms[0].mergepending.value='Y';
document.forms[0].action="mergereftab.jspx";
document.forms[0].submit();
}

function update(quesno,rowno,crtby,shid,mergerowno,mergecrtby,acceptvalue)
{
document.forms[0].tablemerged.value=quesno;
document.forms[0].mergeshid.value=shid;
document.forms[0].recid.value=rowno+'_'+crtby;
document.forms[0].rowno.value=rowno;
document.forms[0].crtby.value=crtby;
document.forms[0].mergerowno.value=mergerowno;
document.forms[0].mergecrtby.value=mergecrtby;
document.forms[0].mergesave.value='Y';
document.forms[0].acceptvalue.value=acceptvalue;
document.forms[0].action='mergereftab.jspx';
document.forms[0].submit();
}

function dateValidation(fvalue)
{
  if (fvalue == null || fvalue == "")
  {
   return true;
  }

  var yr = fvalue.substring(0,4);
  var mm = fvalue.substring(5,7);
    if (!isInteger(yr) || !isInteger(mm) || fvalue.length != 7)
    {

       return false;
    }

    var sep = fvalue.substring(4,5);
    if (yr <= 1000 || (mm <= 0 || mm > 12) || sep != "/" )
    {
       return false;
    }

  return true;
}
function itDateValidation(fvalue)
{

  if (fvalue == null || fvalue == "")
  {
   return false;
  }

  var yr = fvalue.substring(0,4);
  var mm = fvalue.substring(5,7);
    if (!isInteger(yr) || !isInteger(mm) || fvalue.length != 7)
    {

       return false;
    }

    var sep = fvalue.substring(4,5);
    if (yr <= 1000 || (mm <= 0 || mm > 12) || sep != "/" )
    {
       return false;
    }

  return true;
}

function newDateValidation(fvalue)
{


  if (fvalue == null || fvalue == "")
  {
   return true;
  }

  if (fvalue.length < 4)
  {
   return false;

  }
  var yr = fvalue.substring(0,4);
  var mm = fvalue.substring(5,7);
  if (fvalue.length == 4)
  {
    if (!isInteger(yr))
    {

       return false;
    }

    return true;
  }
    if (!isInteger(yr) || !isInteger(mm) || fvalue.length != 7)
    {

       return false;
    }

    var sep = fvalue.substring(4,5);
    if (yr <= 1000 || (mm <= 0 || mm > 12) || sep != "/" )
    {

       return false;
    }

  return true;
}


function addonemonth(sPreviousEndDate)
{
         sYear      =             sPreviousEndDate.substring(0 , 4);
         sMonth     =             sPreviousEndDate.substring(5 , 7);
         if ( sMonth == 12)
         {
             sMonth       =              1;
             sYear++;
         }
         else
         {
             sMonth++;
         }
         if (sMonth < 10)
            sMonth="0"+sMonth;

         return sYear+"/"+sMonth;
}
function textsearch()
{
var nextno = document.forms[0].nextrecordno.value;
if (nextno == null || nextno == "" )
document.forms[0].next.value= "1";
else
document.forms[0].next.value=nextno;
document.forms[0].search.value="1";
document.forms[0].action='advancedsearch.jspx';
document.forms[0].submit();
}
function textsearch1()
{
if (testForEnter())
{
return false;
}
else
{
var nextno = document.forms[0].nextrecordno.value;
if (nextno == null || nextno == "" )
{
document.forms[0].next.value= "1";
}
else
{
document.forms[0].next.value=nextno;
}
document.forms[0].search.value="1";
document.forms[0].action='advancedsearch.jspx';
document.forms[0].submit();
return true;
}
}
function countrysearch()
{
var nextno = document.forms[0].nextrecordno.value;
if (nextno == null || nextno == "" )
document.forms[0].next.value= "1";
else
document.forms[0].next.value=nextno;
document.forms[0].search.value="1";
document.forms[0].action='countrysearch.jspx';
document.forms[0].submit();
}

function countrysearch1()
{
if (testForEnter())
{
return false;
}
else
{
var nextno = document.forms[0].nextrecordno.value;
if (nextno == null || nextno == "" )
{
document.forms[0].next.value= "1";
}
else
{
document.forms[0].next.value=nextno;
}
document.forms[0].search.value="1";
document.forms[0].action='countrysearch.jspx';
document.forms[0].submit();
return true;
}
}
function greaterOrNot(sStartDate , sEndDate)
{

         sStartYear      =             sStartDate.substring(0 , 4);
         sStartMonth     =             sStartDate.substring(5 , 7);
         sEndYear        =             sEndDate.substring(0 , 4);
         sEndMonth       =             sEndDate.substring(5 , 7);
         if (sEndYear < sStartYear)
         return false;
         if (sEndYear == sStartYear && sEndMonth < sStartMonth)
         return false;
         return true;
}
function isOneMonthDifference(sStartDate , sEndDate)
{
         sStartYear      =             sStartDate.substring(0 , 4);

         sStartMonth     =             sStartDate.substring(5 , 7);

         sEndYear        =             sEndDate.substring(0 , 4);
         sEndMonth       =             sEndDate.substring(5 , 7);
         ssEndMonth      =             sStartMonth - 1;


         if (sEndYear > sStartYear)
         return false;
         if (sEndYear == sStartYear && sEndMonth != ssEndMonth)
         {

         return false;

         }
         if (sStartYear > sEndYear && sStartMonth != 1)
         return false;
         return true;
}

function openhelpwindow(language , questno , application)
{

  	helpwindow = window.open('/'+application+'/help/'+language+'/q'+questno+'.htm','help','toolbar=no,scrollbars=yes,resizable=yes');
	helpwindow.focus();


}
function openmenuwindow()
{
	var menuwindow = window.open('welcomepage.htmx?welcome=1','menuwin','toolbar=no,width=600,height=550,scrollbars=yes,dependent=yes,resizable=yes');
	menuwindow.focus();
}
function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}
function openmergewindow(quesno,rowno,crtby,shid)
{
    var  deleteswindow = window.open('search.jspx?quesno='+quesno+'&amp;row='+rowno+'&amp;crtby='+crtby+'&amp;mergeshid='+shid,'sdlwin','toolbar=no,scrollbars=yes,width=700,height=550,dependent=yes,resizable=yes');
	deleteswindow.focus();
}

function resetAll()
{

   for ( i=0; i < document.forms[0].length;i++)
   {
      var elementvalue = document.forms[0].elements[i];

      if (elementvalue.type == "text")
      {

          elementvalue.value = "";
      }
      if (elementvalue.type == "checkbox")
      {

         elementvalue.checked = false;
      }


   }


}
function checkAllTables(checkTable)
{

   for ( i=0; i < document.forms[0].length;i++)
   {
      var elementvalue = document.forms[0].elements[i];
      if (elementvalue.name.indexOf("ref") > -1)
      {

      if (checkTable.checked == true)
      {

          elementvalue.checked = true;
      }
      else
      {

         elementvalue.checked = false;
      }

      }
   }


}

function checkCommonTable(checkTable)
{
   if (checkTable.checked == false)
   {

       document.forms[0].commontables.checked = false;

       return ;

   }

   var count = 0;
   for ( i=0; i < document.forms[0].length;i++)
   {
      var elementvalue = document.forms[0].elements[i];
      if (elementvalue.name.indexOf("ref") > -1)
      {

      if (elementvalue.checked == false)
      {
          count = 1;
          break;

      }

      }
   }
   if ( count == 0)
   {
   document.forms[0].commontables.checked = true;
   }


}
function selectallnfp(checkvalue)
 {

for (var iCount=0; iCount<document.forms[0].length;iCount++) {

        var elNow = document.forms[0].elements[ iCount ];

         if (elNow.name.indexOf("radio") > -1)
        {

        	   if(elNow.value == checkvalue)
        	   {

        	   	elNow.checked = true;
        	   }
        }

     }
checkuncheck();
 }

function checkuncheck()
 {
     var nfpcount = 0;
     var shcount = 0;
       for (var iCount=0; iCount<document.forms[0].length;iCount++) {

        var elNow = document.forms[0].elements[ iCount ];

         if (elNow.name.indexOf("radio") > -1)
        {

        	   if(elNow.value == 1 && elNow.checked == false)
        	   {
        	   	nfpcount = 1;
        	   }
         	   if(elNow.value == 2 && elNow.checked == false)
        	   {
        	   	shcount = 1;
        	   }


        }

     }

if (nfpcount == 0)
document.forms[0].allnfp.checked = true;
else
document.forms[0].allnfp.checked = false;
if (shcount == 0)
document.forms[0].allsh.checked = true;
else
document.forms[0].allsh.checked = false;

 }


function openalertwindow(mesg)
{
 document.forms[0].alertmessage.value=mesg;
 alertwindow = window.open('alert.htmx','alertwin','toolbar=no,width=400,height=150,scrollbars=no,dependent=yes,resizable=no');
 alertwindow.focus();
}
function openconfirmwindow(mesg)
{
 document.forms[0].confirmmessage.value=mesg;
 confirmwindow = window.open('confirm.htmx','confirmwin','toolbar=no,width=400,height=150,scrollbars=no,dependent=yes,resizable=no');
 confirmwindow.focus();
}

// Returns true if string s is empty or
// whitespace characters only.

function isWhitespace (s)

{   var i;

    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

function isSignedFloat (s)

{   if (isEmpty(s))
       if (isSignedFloat.arguments.length == 1) return defaultEmptyOK;
       else return (isSignedFloat.arguments[1] == true);

    else {
        var startPos = 0;
        var secondArg = defaultEmptyOK;

        if (isSignedFloat.arguments.length > 1)
            secondArg = isSignedFloat.arguments[1];

        // skip leading + or -
        if ( (s.charAt(0) == "-") || (s.charAt(0) == "+") )
           startPos = 1;
        return (isFloat(s.substring(startPos, s.length), secondArg))
    }
}

function isInteger(val){
	for(var i=0;i<val.length;i++){
		if(!isDigit(val.charAt(i))){return false;}
		}
	return true;
	}
function isDigit(num) {
	if (num.length>1){return false;}
	var string="1234567890";
	if (string.indexOf(num)!=-1){return true;}
	return false;
	}
function activityareagotopage(quesno1)
{
document.forms[0].quesno.value=quesno1;
document.forms[0].act.value='DISPLAY';
document.forms[0].instid.value="";
document.forms[0].action='ques.jspx';
document.forms[0].submit();
}
function activityareagomain(quesno1,actid)
{
document.forms[0].quesno.value=quesno1;
document.forms[0].activityarea.value=actid;
document.forms[0].action='ques.jspx';
document.forms[0].submit();
}
function activityareagotoref(quesno1,actid)
{
document.forms[0].quesno.value=quesno1;
document.forms[0].activityarea.value=actid;
document.forms[0].action='search.jspx?firstvisit=Y';
document.forms[0].submit();
}
function activityareagotoactivity(actno)
{
document.forms[0].activityarea.value=actno;
document.forms[0].listtype.value='q';
document.forms[0].action='activityarea.jspx';
document.forms[0].submit();
}
function activityareagotoind(actno)
{
document.forms[0].activityarea.value=actno;
document.forms[0].listtype.value='i';
document.forms[0].action='activityarea.jspx';
document.forms[0].submit();
}
function activityareagotoindques(indno,actno)
{
document.forms[0].activityarea.value=actno;
document.forms[0].listtype.value='q';
document.forms[0].inum.value=indno;
document.forms[0].action='activityarea.jspx';
document.forms[0].submit();
}
function activityareagotoquesind(qno,actno)
{
document.forms[0].activityarea.value=actno;
document.forms[0].listtype.value='i';
document.forms[0].qnum.value=qno;
document.forms[0].action='activityarea.jspx';
document.forms[0].submit();
}

function activityareagoversion(act2)
{
document.forms[0].activityarea.value=act2;
document.forms[0].action='version.jspx';
document.forms[0].submit();
}
function clearmerge(quesno,shid,rowno,crtby)
{
document.forms[0].tablemerged.value=quesno;
document.forms[0].mergeshid.value=shid;
document.forms[0].recid.value=rowno+'_'+crtby;
document.forms[0].mergedisplay.value='Y';
document.forms[0].mergerecord.value='';
document.forms[0].clearmerge.value='Y';
document.forms[0].action='mergereftab.jspx';
document.forms[0].submit();
}
function displayrecord(quesno,shid)
{
document.forms[0].tablemerged.value=quesno;
document.forms[0].mergeshid.value=shid;
document.forms[0].action='mergereftab.jspx';
document.forms[0].submit();
}
function comparison(quesno,rowno,crby,mrowno,mcrtby,shid)
{
document.forms[0].quesno.value=quesno;
document.forms[0].rowno.value=rowno;
document.forms[0].crtby.value=crby;
document.forms[0].mergerowno.value=mrowno;
document.forms[0].mergecrtby.value=mcrtby;
document.forms[0].shid.value=shid;
document.forms[0].action='comparereftab.jspx';
document.forms[0].submit();
}
	function backtoversion(a1)
                                 {
                                        document.forms[0].activityarea.value=a1;
						document.forms[0].action='version.jspx';
						document.forms[0].submit();
					}
					function popUp( a2 )
					{
					     document.forms[0].alertmessage.value=a2;
					     openwin('info.htmx','srcwindow','resizable=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,menubar=no,width=300,height=200' );
					}


					function retabreportnextrec(quesno,nextno)
{
document.forms[0].quesno.value=quesno;
document.forms[0].NEXT.value=nextno;
document.forms[0].action='reftabreport.jspx';
document.forms[0].submit();
}

					function gotoques(ques4)
					{
						document.forms[0].quesno.value=ques4;
						document.forms[0].act.value='';
						document.forms[0].edittype.value='';
						document.forms[0].action='quesversion.jspx';
						document.forms[0].submit();
					}

					function changeoption(iterat, ques5, act5, edittype5)
					{
						document.forms[0].tablename_list.value=iterat.options[iterat.selectedIndex].value;
						document.forms[0].quesno.value=ques5;
						document.forms[0].act.value=act5;
						document.forms[0].edittype.value=edittype5;
						document.forms[0].action='quesversion.jspx';
						document.forms[0].submit();
					}

function displaytable(quesno,recid,shid)
{
document.forms[0].tablemerged.value=quesno;
document.forms[0].mergeshid.value=shid;
document.forms[0].recid.value=recid;
document.forms[0].mergedisplay.value='Y';
document.forms[0].action='mergereftab.jspx';
document.forms[0].submit();
}
function importanswers(quesno,shid)
{
document.forms[0].tablemerged.value=quesno;
document.forms[0].mergeshid.value=shid;
document.forms[0].action='mergereftab.jspx';
document.forms[0].importvalue.value='1';
document.forms[0].submit();
}
function shstatmakeBlank()
{
for (var i = 0; i < document.forms[0].stakeholders.options.length; i++)
  {
   document.forms[0].stakeholders.options[i].selected = null;
  }
for (var i = 0; i < document.forms[0].iterations.options.length; i++)
  {
   document.forms[0].iterations.options[i].selected = null;
  }
}


function compareclearmerge(quesno,shid,recid)
{
	document.forms[0].tablemerged.value=quesno;
	document.forms[0].mergeshid.value=shid;
	document.forms[0].recid.value=recid;
	document.forms[0].mergerecord.value='';
	document.forms[0].mergedisplay.value='Y';
	document.forms[0].clearmerge.value='Y';
	document.forms[0].action='mergereftab.jspx';
	document.forms[0].submit();
}
function reftabreportnextrec(quesno,nextno)
{
document.forms[0].quesno.value=quesno;
document.forms[0].NEXT.value=nextno;
document.forms[0].action='reftabreport.jspx';
document.forms[0].submit();
}

function uploaddata()
{
document.forms[0].upload.value=3;
document.forms[0].action='upload.jspx';
document.forms[0].submit();
}


function treeaction( pk , position , expandOrContract)
{
document.forms[0].act.value=expandOrContract;
document.forms[0].position.value=position;
document.forms[0].submit();
}


function distributecdchangeoption()
{
document.forms[0].orgid.value='';
document.forms[0].crtby.value='';
document.forms[0].createdata.value='';
document.forms[0].unregister.value='';
document.forms[0].action='distributecd.jspx';
document.forms[0].submit();
}
function distributecdsubmitform()
{
document.forms[0].createdata.value='Y';
document.forms[0].unregister.value='';
document.forms[0].action='distributecd.jspx';
document.forms[0].submit();
}

function docsopendocs(link,path)
{
   document.forms[0].filename.value=path;
   document.forms[0].path.value=link;
   document.forms[0].action='fileoutput.htmx';
   document.forms[0].submit();

}
function exportopendocs(link,path)
{
   document.forms[0].filename.value=path;
   document.forms[0].path.value=link;
   document.forms[0].createdata.value='';
   document.forms[0].action='fileoutput.htmx';
   document.forms[0].submit();

}
function exportanswersselectcountry(country)
{
document.forms[0].countrycode.value=country.options[country.selectedIndex].value;
document.forms[0].login.value="";
document.forms[0].action='selectcountry.jspx';
document.forms[0].submit();
}
function selectcountry(country)
{
document.forms[0].countrycode.value=country.options[country.selectedIndex].value;
document.forms[0].login.value="";
document.forms[0].action='selectcountry.jspx';
document.forms[0].submit();
}

function submitactivity(country,path)
{
var countrycode=document.forms[0].countrycode.value;
var language = document.forms[0].language.value;
if (language == 0)
return false;
if (countrycode == 0)
{
 document.forms[0].action="/"+path+'/countrysearch.jspx';


}
else
{
document.forms[0].login.value="Y";
document.forms[0].action="/"+path+"/"+countrycode+'/advancedsearch.jspx';
}
document.forms[0].submit();
}
function submitasia(country,path)
{
var countrycode=document.forms[0].countrycode.value;
var language = document.forms[0].language.value;
if (language == 0)
return false;
if (countrycode == 0)
{
 document.forms[0].action='asiaregsearch.jspx';


}
else
{
document.forms[0].login.value="Y";
document.forms[0].action="/"+path+"/"+countrycode+'/advancedsearch.jspx';
}
document.forms[0].submit();
}
function dateValidation(fvalue)
{


  if (fvalue == null || fvalue == "")
  {
   return true;
  }

  var yr = fvalue.substring(0,4);
  var mm = fvalue.substring(5,7);
    if (!isInteger(yr) || !isInteger(mm) || fvalue.length != 7)
    {
       return false;
    }

    var sep = fvalue.substring(4,5);
    if (yr <= 1000 || (mm <= 0 || mm > 12) || sep != "/" )
    {
       return false;
    }

  return true;
}

function newDateValidation(fvalue)
{


  if (fvalue == null || fvalue == "")
  {
   return true;
  }
  if (fvalue.length < 4)
   return false;
  var yr = fvalue.substring(0,4);
  var mm = fvalue.substring(5,7);
  if (fvalue.length = 4)
  {
    if (!isInteger(yr))
    {
       return false;
    }
    return true;
  }
    if (!isInteger(yr) || !isInteger(mm) || fvalue.length != 7)
    {
       return false;
    }

    var sep = fvalue.substring(4,5);
    if (yr <= 1000 || (mm <= 0 || mm > 12) || sep != "/" )
    {
       return false;
    }

  return true;
}
function exportdatasubmitform()
{
self.opener.document.forms[0].createdata.value='Y';
self.opener.document.forms[0].unregister.value='';
self.opener.document.forms[0].action='distributecd.jspx';
self.opener.document.forms[0].submit();
window.close();
}
function setguestlanguage()
{
document.forms[0].login.value="Y";
document.forms[0].action="activityarea.jspx";
document.forms[0].submit();
}


function loginguest()
{
document.forms[0].guest.value=true;
document.forms[0].login.value="Y";
document.forms[0].action="activityarea.jspx";
document.forms[0].submit();
}
function slogin()
{
document.forms[0].login.value="";
document.forms[0].action="activityarea.jspx";
document.forms[0].submit();
}

function importdownloadExcel(f)
{
   document.errorform.filename.value=f;
   document.errorform.action='popfile.jsp';
   document.errorform.submit();
}
function importchangeoption(iterat, importquestion,iterpage)
{

document.location.href='import.jspx?iterationpage='+iterpage+'&amp;importques='+importquestion+'&amp;version='+iterat.options[iterat.selectedIndex].value;

}


function exportsubmitform1()
{
document.forms[0].filename.value='';
document.forms[0].path.value='';
document.forms[0].action='export.jspx';
document.forms[0].createdata.value='Y';
document.forms[0].submit();
}

function distributecdsendcd(orgid,crtby)
{
 	registerwindow = window.open('register.jspx?orgid='+orgid+'&crtby='+crtby+'&unregister=0','registerwin','toolbar=no,width=300,height=200,scrollbars=no,dependent=yes,resizable=no');
	registerwindow.focus();


}

function distributecdunregister(orgid,crtby)
{
	registerwindow = window.open('register.jspx?orgid='+orgid+'&crtby='+crtby+'&unregister=1','registerwin','toolbar=no,width=300,height=200,scrollbars=no,dependent=yes,resizable=no');
	registerwindow.focus();
}

function comparemerge(quesno,shid,recid,rowno,crtby)
{
document.forms[0].tablemerged.value=quesno;
document.forms[0].mergerowno.value=rowno;
document.forms[0].mergecrtby.value=crtby;
document.forms[0].mergeshid.value=shid;
document.forms[0].recid.value=recid;
document.forms[0].mergedisplay.value='Y';
document.forms[0].mergerecord.value='Y';
document.forms[0].action='mergereftab.jspx';
document.forms[0].submit();


}

function closeiteration( conflabel )
{
if (confirm(conflabel))
document.forms[0].closeit.value=true;
document.forms[0].submit();
}

function activityareagoquesversion(quesno3)
{
document.forms[0].quesno.value=quesno3;
document.forms[0].action='quesversion.jspx';
document.forms[0].submit();
}
function openwin(a , b , c )
{
 	repwindow = window.open(a , b , c );
	repwindow.focus();
}