﻿// JScript File

var workingDir 	= '/prgm/';
var dc_AdLinkColor = '#009600' ; 	// used for Kontera
var dc_PublisherID = 139100 ; 		// used for Kontera

function checkQuiz(form)  {
        
	var valid = false;
	for (var i = 1; i <= form.Qcnt.value; i++) {
//	    alert(eval('form.Acnt'+i+'.value'));
		for (var j = 0; j <= eval('form.Acnt'+i+'.value')-1; j++) {
//			alert(i+' : '+j);
			if (eval('form.Poll'+i+'['+j+'].checked')==true)
				valid=true;				
		}
		if (valid==false) {
			alert ('Please fill in one answer for each question');
			return false;
		}
		else
			valid = false;				
	}
	return true;
}

function OpenLinkUpdate(LinkType, Id, Prod )
{
  alert('yes');
	LinkURL = workingDir + 'WebFormLinks.aspx?LinkType=' + LinkType + '&Id=' + Id + '&Prod=' + Prod;	
	window.open (LinkURL, LinkType, 'scrollbars=1,titlebar=1,status=1,resizable=1,ll;l, height=410, width=804');

}

function ltrimX(s) { 
 return s.replace( /^\s*/, '' ); }

function rtrimX(s) { 
 return s.replace( /\s*$/, '' ); }

function trimX(s) { 
 return rtrimX(ltrimX(s)); }

function CheckLenX(AreaField,maxlen,idval) {
   if(AreaField.value.length <= maxlen)
       document.getElementById(idval).innerHTML = maxlen - AreaField.value.length + ' character(s) remaining';
   else
       document.getElementById(idval).innerHTML = AreaField.value.length-maxlen  + ' character(s) over limit - entry will be truncated';
   }


function GoogleSearch( path )
{
    if (path.q_Main.value=='')  {
        alert ('Please supply a search value');
        }
    else {
        SendTo ('/Search/HealthySearchResult.aspx?q=' + path.q_Main.value + '&cx=012629307392664619338:sxlgiutbo78&cof=FORID:11');
        //window.location.href ='/Search/HealthySearchResult.aspx?q=' + path.q_Main.value + '&cx=012629307392664619338:sxlgiutbo78&cof=FORID:11';
        //window.location.focus;
//        window.status='..loading';
//        alert ('there'+s);
    }
}


function SendTo (myhref)  {

    window.location.href = myhref;
    window.location.refresh
    //window.refresh;
    //alert('t2');

}

function ReportComment( ele_value, kynd , lknd, ta_element )
{
     var Urs = document.getElementById(ta_element).value;
     window.status='..sending';
     window.location.href ='/prgm/ReportComment.aspx?md=' + ele_value + '&Kynd=' + kynd + '&Lknd=' + lknd + '&Urs=' + Urs ;
     alert('Your concern has been sent to our staff\n\n Thank you for taking the time to report this issue!')
     //var t=setTimeout("alert('Your concern has been sent to our staff\n\n Thank you for taking the time to report this issue!')",2000);
     window.status='';
}

function ShowHidePanel ( element,showhide )
{
    if (showhide=='s') {
        document.getElementById(element).style.height='126px';
        document.getElementById(element).style.width='486px';
        document.getElementById(element).style.visibility='visible';
        }
    else    {
        document.getElementById(element).style.visibility='hidden';
    }
}


function testThis() {

  //  alert('yes');
  
}
