//________________________________________________________________________________________________
//_____________________      isEmail     _____________________________________________________________

function isEmail(string) {
    if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
}


function doViewPostReply(sDivID, sImgID){
	var oDiv = document.getElementById(sDivID);
	if ((oDiv.style.display == "block")||(oDiv.style.display == "")){
		document.getElementById(sDivID).style.display = "none";
		document.getElementById(sImgID).src = "images/arrowR.gif";
	}
	else{
		document.getElementById(sDivID).style.display = "block";
		document.getElementById(sImgID).src = "images/arrowD.gif";
	}
}

function doChangeLanguage(hLanguageID){
		document.frmLanguage.hLanguageID.value = hLanguageID;
		document.frmLanguage.submit();
}

 //__________________________________________________________________________
//_________    ValidGo    ________________________________________________________

function ValidGo() {
	if (isWhitespace(document.frmSearch.KeySearch.value)) {
	     alert("Please enter Search Key! ");
	     document.frmSearch.KeySearch.focus();
	     return false;
	}  
	document.frmSearch.GoSearch.value =1;
	 return true;
}

 //__________________________________________________________________________
//_________    ValidGoRo    ________________________________________________________

function ValidGoRo() {
	if (isWhitespace(document.frmSearch.KeySearch.value)) {
	     alert("Va rugam, tastati un cuvant cheie! ");
	     document.frmSearch.KeySearch.focus();
	     return false;
	}  
	document.frmSearch.GoSearch.value =1;
	 return true;
}

//________________________________________________________________________________________________
//_____________________      isNum     _____________________________________________________________

function isNum(chr)            // is character a number?
  {
  if (chr < "0" || chr > "9")  // nope
    return false;
  else                         // yep
    return true;
  }


//________________________________________________________________________________________________
//_____________________      isNumber19     _____________________________________________________________

function isNumber19(InString)  {
        RefString="123456789";

        for (Count=0; Count < InString.length; Count++)  {
            TempChar= InString.substring (Count, Count+1);
            if (RefString.indexOf (TempChar, 0)==-1) { 
				alert("Please enter numbers only: 1 - 9 ");
				return false;
			}
		}
        return true;
}



//________________________________________________________________________________________________
//_____________________      warnEmpty     _____________________________________________________________
var reWhitespace = /^\s+$/
// warnEmpty (theField, s)             Notify user that required field theField is empty.


// Notify user that required field theField is empty.
// String s describes expected contents of theField.value.
// Put focus in theField and return false.

function warnEmpty (theField, s)
{   theField.focus()
    alert(mPrefix + s + mSuffix)
    return false
}


//________________________________________________________________________________________________
//_____________________      isEmpty     _____________________________________________________________
function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}



//________________________________________________________________________________________________
//_____________________      isWhitespace     _____________________________________________________________

function isWhitespace (s)

{   // Is s empty?
//    return (isEmpty(s));
    return (isEmpty(s) || reWhitespace.test(s));
}


//________________________________________________________________________________________________
//_____________________      goSubmMy     _____________________________________________________________

function goSubmMy(page,groupCrt,ID){
		document.myform.page.value = page;
		document.myform.sCMD.value = "";
		document.myform.groupCrt.value = groupCrt;
		document.myform.ID.value = ID;
		document.myform.submit();
}




function Start(page) {
	OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=550,height=250,top=50,left=50");
}



function isInteger (s)

{   var i;

    if (isEmpty(s)) 
       if (isInteger.arguments.length == 1) return defaultEmptyOK;
       else return (isInteger.arguments[1] == true);

    // 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 (!isDigit(c)) return false;
    }

    // All characters are numbers.
    return true;
}
function warnInvalid (theField, s)
{   theField.focus()
    theField.select()
    alert(s)
    return false
}


function isInt(chr)           
{
	if (isNaN(chr))
	{return false; }
	else
	  {
		if (chr>0)
		{ return true;	}
		else
		  { return false; }	  
	   }
}



function OpenPage(page) {
	OpenWin = window.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=750,height=650,top=10,left=10");
	return true;
}

