//____________________________________________________________________________________
//________      ValidLogin                  ________________________________________________________

function ValidLogin() {
	if (isWhitespace(document.frmTop.MAccountName.value)) 
	{
	     alert("Please enter User Name!  ");
	     document.frmTop.MAccountName.focus();
	     return false;
	}  
	if (document.frmTop.MAccountName.value.length < 4) 
	{
	     alert("The Minimum length for User Name should be 4!");
	     document.frmTop.MAccountName.focus();
	     return false;
	 }

	if (isWhitespace(document.frmTop.MAccountPassword.value)) 
	{
	     alert("Please enter  User Password! ");
	     document.frmTop.MAccountPassword.focus();
	     return false;
	}  
	 if (document.frmTop.MAccountPassword.value.length < 4) 
	 {
	     alert("The Minimum length for User Password should be 4!");
	     document.frmTop.MAccountPassword.focus();
	     return false;
	 }
	 return true;
}




//____________________________________________________________________________________
//________      ValidAccount                  ________________________________________________________

function ValidAccount() {
	if (isWhitespace(document.myform.AccountOld.value)) 
	{
	     alert("Completeaza Cont vechi!  ");
	     document.myform.AccountOld.focus();
	     return false;
	}  
	if (isWhitespace(document.myform.AccountNew.value)) 
	{
	     alert("Completeaza Cont nou!  ");
	     document.myform.AccountNew.focus();
	     return false;
	}  
	if (isWhitespace(document.myform.PasswdOld.value)) 
	{
	     alert("Completeaza Parola veche!  ");
	     document.myform.PasswdOld.focus();
	     return false;
	}  
	if (isWhitespace(document.myform.PasswdNew.value)) 
	{
	     alert("Completeaza Parola noua!  ");
	     document.myform.PasswdNew.focus();
	     return false;
	}  
	 return true;
}



//____________________________________________________________________________________
//_____________      ValidMem    ____________________________________________________

function ValidMem() {
	if (isWhitespace(document.myform.MFirstName.value)) 
	{
	     alert("Completeaza prenumele! ");
	     document.myform.MFirstName.focus();
	     return false;
	}  
	if (isWhitespace(document.myform.MLastName.value)) 
	{
	     alert("Completeaza numele de familie! ");
	     document.myform.MLastName.focus();
	     return false;
	}  
	if (document.myform.MEmail.value.length>0){ 
	document.myform.MEmail.value = NonSpace(document.myform.MEmail.value);

	if (isEmail(document.myform.MEmail.value)==false) {
			alert("Please enter a valid E-Mail address, like: name@companyname.com ");
			document.myform.MEmail.focus();
			return false;
	}  
	}
	
	if (document.myform.blob.value!="")	{
		myext = getExtension(document.myform.blob.value);
		if ((myext != "gif") && (myext != "jpg") && (myext != "jpe") && (myext != "jpeg")  && (myext != "bmp")){
			alert ("Please Upload an Image with GIF,JPEG,BMP or JPG extension !");
			document.myform.blob.value.focus;
		return false; 
		}
	}				
	 return true;
}




//____________________________________________________________________________________
//_____________      ValidNews     ____________________________________________________

function ValidNews() {
	if (isWhitespace(document.myform.NewsDate.value)) 
	{
	     alert("Completeaza data stirii! ");
	     document.myform.NewsDate.focus();
	     return false;
	}  
	if (isWhitespace(document.myform.NewsTitle.value)) 
	{
	     alert("Completeaza titlul stirii! ");
	     document.myform.NewsTitle.focus();
	     return false;
	}  
	if (isWhitespace(document.myform.xText.value)) 
	{
	     alert("Completeaza textul stirii! ");
	     document.myform.xText.focus();
	     return false;
	}  
	 return true;
}

//____________________________________________________________________________________
//_____________      ValidEv   ____________________________________________________

function ValidEv() {
	if (isWhitespace(document.myform.EvDate.value)) 
	{
	     alert("Completeaza data evenimentului! ");
	     document.myform.EvDate.focus();
	     return false;
	}  
	if (isWhitespace(document.myform.EvTitle.value)) 
	{
	     alert("Completeaza titlul evenimentului! ");
	     document.myform.EvTitle.focus();
	     return false;
	}  
//	if (isWhitespace(document.myform.xText.value)) 
//	{
//	     alert("Completeaza textul evenimentului! ");
//	     document.myform.xText.focus();
//	     return false;
//	}  
	 return true;
}


//____________________________________________________________________________________
//_____________      ValidPhoto     ____________________________________________________


function ValidPhoto() {
	
	if ((  isWhitespace(document.myform2.Poza.value)) && (  isWhitespace(document.myform2.Image.value))  )
	{
	     alert("Selecteaza Poza ! ");
	     document.myform2.PhTitle.focus();
	     return false;
	}  
	if (document.myform2.Poza.value!="")	{
		myext = getExtension(document.myform2.Poza.value);
		if ((myext != "gif") && (myext != "jpg") && (myext != "jpeg") && (myext != "jpe")  && (myext != "bmp")){
				alert ("Se admit doar extensiile  GIF,JPEG,BMP or JPG extension !");
				document.myform2.Poza.value.focus();
		return false; 
		}
	}		
	if (document.myform2.Poza.value!="")	{
		if (document.myform2.width.value ==0) {
	     alert(" Verifica dimensiunile ! ");
	     document.myform2.width.focus();
	     return false;
		}
	}  
//	if (document.myform2.Poza.value!="")	{
//		if (document.myform2.width.value > 450) {
//	     alert(" width > 450! ");
//	     document.myform2.width.focus();
//	     return false;
//		}
//	}  
	if (document.myform2.Poza.value!="")	{
		if (document.myform2.height.value ==0) {
	     alert(" Verifica dimensiunile ! ");
	     document.myform2.height.focus();
	     return false;
		}
	}  	
//	if (document.myform2.Poza.value!="")	{
//		if (document.myform2.height.value > 450) {
//	     alert(" height > 450!");
//	     document.myform2.height.focus();
//	     return false;
//		}
//	}  	
return true;
}





//____________________________________________________________________________________
//_____________     ValidMessage      ________________________________________________

function ValidMessage() {
	if (isWhitespace(document.myform.Subject.value)) 
	{
	     alert("Completeaza subjectul! ");
	     document.myform.Subject.focus();
	     return false;
	}  
	if (isWhitespace(document.myform.xText.value)) 
	{
	     alert("Completeaza textul  mesajului ! ");
	     document.myform.xText.focus();
	     return false;
	}  
	 return true;
}



//____________________________________________________________________________________
//_____________     ValidPoem      ________________________________________________

function ValidPoem() {
	if (isWhitespace(document.myform.xText.value)) 
	{
	     alert("Completeaza textul  mesajului ! ");
	     document.myform.xText.focus();
	     return false;
	}  
	 return true;
}

//____________________________________________________________________________________
//_____________     ValidEmail1      ________________________________________________

function ValidEmail1() {
	if (isWhitespace(document.myform.email.value)) 
	{
	     alert("Completeaza Email! ");
	     document.myform.email.focus();
	     return false;
	}  
	if (isEmail(document.myform.email.value)==false) {
			alert("Please enter a valid E-Mail address, like: name@companyname.com ");
			document.myform.email.focus();
			return false;
	}  
	 return true;
}


//____________________________________________________________________________________
//_____________     ValidSendEmail      ________________________________________________

function ValidSendEmail() {
	if (isWhitespace(document.myform.email.value)) 
	{
	     alert("Completeaza Email! ");
	     document.myform.email.focus();
	     return false;
	}  
	if (isEmail(document.myform.email.value)==false) {
			alert("Please enter a valid E-Mail address, like: name@companyname.com ");
			document.myform.email.focus();
			return false;
	}  
	 return true;
}


//____________________________________________________________________________________
//_____________     ValidSEmail      ________________________________________________

function ValidSEmail() {
	if (isWhitespace(document.frmEmail.comments.value)) 
	{
	     alert("Completati Mesajul! ");
	     document.frmEmail.comments.focus();
	     return false;
	}  
	 return true;
}




//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~      ValidForm      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function ValidForm() {

	var theForm = document.forms[0];
	var nr = theForm.length;
	var cod = 0;

	for (i=0; i<nr; i++){
		if (theForm.elements[i].type != "hidden" && theForm.elements[i].type != "submit" && theForm.elements[i].type != "radio" ){
//		alert(theForm.elements[i].value+theForm.elements[i].name);
			if (theForm.elements[i].value != "" && theForm.elements[i].value != "0"){cod = 1;}
		}
	}
		if (cod == 0) {
			alert("Completeaza textul!");
			theForm.AccountName.focus();
			return false;
		}			
	if (document.myform.MID.value.length>0){ 
	if (isNumber2(document.myform.MID.value)==false) {
			document.myform.MID.focus();
			return false;
	}
	}
	
	return true;
}



//____________________________________________________________________________________
//_____________      NonSpace     ____________________________________________________

function NonSpace(field) {

	var xpos =0;
	var xlen =field.length;
	var xpos1 =0;
	var xpos2 =xlen;

	for (var i=0; i < xlen; i++) {
		temp = "" + field.substring(i, i+1);
		if (temp == " ") {xpos++;}
		else {var xpos1=xpos;break;  }
	}
	field = field.substring(xpos1, xlen)
	var xlen1 = field.length;

	for (var i=0; i < xlen1; i++) {
		temp = "" + field.substring(i, i+1);
		if (temp != " ") {xpos1++;}
		else {xpos2=i;break;  }
	}
	field = field.substring(0, xpos2)
	return field;
}



//____________________________________________________________________________________
//_____________     IsChar      ______________________________________________________


var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|]/;

function IsChar(val) {
var strPass = val.value;
var strLength = strPass.length;
var lchar = val.value.charAt((strLength) - 1);
if(lchar.search(mikExp) != -1) {
var tst = val.value.substring(0, (strLength) - 1);
val.value = tst;
   }
}


//____________________________________________________________________________________
//____________  IsChara   ____________________________________________________________

function IsChara(form) {
if(form.value.length < 1) {
alert("Please fill this field; cannot be empty.");
return false;
}
if(form.value.search(mikExp) == -1) {
return true;
}
else {
alert("Sorry, but the following characters\n\r\n\r@ $ % ^ & * # ( ) [ ] \\ { + } ` ~ =  | \n\r\n\rare not allowed!\n");
form.select();
form.focus();
return false;
}
return true;
}


//____________________________________________________________________________________
//______________   Valid_Date  _______________________________________________________

function Valid_Date(datein){
        
        var indate=datein;
        if (indate.indexOf("-")!=-1){
                var sdate = indate.split("-")
        }
        else {
                var sdate = indate.split("/")
        }
        var chkDate=new Date(Date.parse(indate))
        var cmpDate=(chkDate.getMonth()+1)+"/"+(chkDate.getDate())+"/"+(chkDate.getFullYear())
        var indate2=(Math.abs(sdate[0]))+"/"+(Math.abs(sdate[1]))+"/"+(Math.abs(sdate[2]))

		if ((chkDate.getFullYear() > 3000)||(chkDate.getFullYear() < 1900)) {
                alert("You've entered an invalid year");
				return false;
		}				
		if ((Math.abs(sdate[2]) > 3000)||(Math.abs(sdate[2])< 1900)) {
                alert("You've entered an invalid year");
				return false;
		}				


   if (indate2=="0/NaN/NaN"){
				return true;
   }        
	else {
 		
        if (indate2!=cmpDate){
                alert("You've entered an invalid date or date format.  Please use the MM/DD/YYYY format.");
				return false;
        }
        else {
                if (cmpDate=="NaN/NaN/NaN"){
                        alert("You've entered an invalid date or date format. Please use the MM/DD/YYYY format.");
						return false;
                }
                else {
						return true;
                }       
        }
}        
}



//____________________________________________________________________________________
//__________    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;
}



//____________________________________________________________________________________
//______________    IsPhone     ______________________________________________________

function IsPhone(str)          // is phone str valid
    {
    if (str.length != 12) 
              // nope - wrong str length
		{
		alert('Invalid PhoneNo. Must be in the form NNN-NNN-NNNN.');
		return false;
	}		
  for (i=0; i<12; i++)
    {
    if (i == 3 || i == 7)
    {
      if (str.charAt(i) != "-")     // nope - "-" missing
			{
			alert(' Missing - . PhoneNo  must be in the form NNN-NNN-NNNN.');
			return false;
			}
	}		
	else
    {
      if (!isNum(str.charAt(i)))
		{
		alert('Non-numeric characters. PhoneNo must be in the form NNN-NNN-NNNN.');
		return false;
		}
	}		
  }
  return true;                     

}


//____________________________________________________________________________________
//_______________    IsFax     _______________________________________________________

function IsFax(str)          // is Fax str valid
    {
    if (str.length != 12) 
              // nope - wrong str length
		{
		alert('Invalid FaxNo. Must be in the form NNN-NNN-NNNN.');
		return false;
	}		
  for (i=0; i<12; i++)
    {
    if (i == 3 || i == 7)
    {
      if (str.charAt(i) != "-")     // nope - "-" missing
			{
			alert(' Missing - . FaxNo  must be in the form NNN-NNN-NNNN.');
			return false;
			}
	}		
	else
    {
      if (!isNum(str.charAt(i)))
		{
		alert('Non-numeric characters. FaxNo must be in the form NNN-NNN-NNNN.');
		return false;
		}
	}		
  }
  return true;                     

}


//____________________________________________________________________________________
//_____________     validateZIP   ____________________________________________________


function validateZIP(field) {
var valid = "0123456789-";
var hyphencount = 0;

if (field.value.length!=5 && field.value.length!=10) {
alert("Please enter your 5 digit or ( 5 + 4 ) digit  ZIP  code.");
return false;
}
for (var i=0; i < field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (temp == "-") hyphencount++;
if (valid.indexOf(temp) == "-1") {
alert("Invalid characters in your ZIP code.  Please try again.");
return false;
}
if ((hyphencount > 1) || ((field.value.length==10) && ""+field.value.charAt(5)!="-")) {
alert("The hyphen character should be used with a properly formatted 5 digit+four  ZIP  code, like '12345-6789'.   Please try again.");
return false;
   }
}
return true;
}



function isNum(chr)            // is character a number?
  {
  if (chr < "0" || chr > "9")  // nope
    return false;
  else                         // yep
    return true;
  }



function isNumber(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;
}

function isNumber1(InString)  {
        RefString="0123456789";

        for (Count=0; Count < InString.length; Count++)  {
            TempChar= InString.substring (Count, Count+1);
            if (RefString.indexOf (TempChar, 0)==-1) { 
				alert("Please enter numbers only: 0 - 9 ");
				return false;
			}
		}
        return true;
}



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
}



// Check whether string s is empty.
function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

// Returns true if string s is empty or 
// whitespace characters only.

function isWhitespace (s)

{   // Is s empty?
//    return (isEmpty(s));
    return (isEmpty(s) || reWhitespace.test(s));
}


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goSort      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goSort(url,sSortBy,sSortOrd)
{
		document.myform1.action = url;
		document.myform1.SortBy.value  = sSortBy;
		document.myform1.SortOrd.value = sSortOrd;
		document.myform1.submit( );
}




//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goSortf      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goSortf(url,sSortBy,sSortOrd)
{
		document.myform.action = url;
		document.myform.SortBy.value  = sSortBy;
		document.myform.SortOrd.value = sSortOrd;
		document.myform.submit( );
}




//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goDel      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goDel(url,ID)   
{
	if (confirm("This Record will be deleted! Are you sure !?"))
		{
		document.myform1.sCMD.value = "del";
		document.myform1.ID.value = ID;
		document.myform1.action = url;
		document.myform1.submit();
		}
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goDell      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goDell(url,ID)   
{
	if (confirm("This Record will be deleted! Are you sure !?"))
		{
		document.myform.sCMD.value = "del";
		document.myform.MessID.value = ID;
		document.myform.action = url;
		document.myform.submit();
		}
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goMod      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goMod(url,ID)   
{
		document.myform1.sCMD.value = "edit";
		document.myform1.ID.value = ID;
		document.myform1.action = url;
		document.myform1.submit();
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goModM      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goModM(url)   
{
		document.myform1.sCMD.value = "edit";
		document.myform1.action = url;
		document.myform1.submit();
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goSubm      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goSubm(xCMD,ID)   
{
		document.myform1.sCMD.value = xCMD;
		document.myform1.ID.value = ID;
		document.myform1.submit();
}

//________________________________________________________________________________________________
//_____________________      goSubmM     _____________________________________________________________

function goSubmM(url,page,groupCrt,sSortBy,sSortOrd){
		document.myform1.page.value = page;
		document.myform1.groupCrt.value = groupCrt;
		document.myform1.SortBy.value = sSortBy;
		document.myform1.SortOrd.value = sSortOrd;
		document.myform1.action = url;
		document.myform1.submit();
}




//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goSubmit      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goSubmit(url,xCMD,ID)   
{
		document.myform1.sCMD.value = xCMD;
		document.myform1.ID.value = ID;
		document.myform1.action = url;
		document.myform1.submit();
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goSubmMc      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goSubmMc(url,page,sSortBy,sSortOrd){
		document.myform1.page.value = page;
		document.myform1.SortBy.value = sSortBy;
		document.myform1.SortOrd.value = sSortOrd;
		document.myform1.action = url;
		document.myform1.submit();
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goSubmUpd      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goSubmUpd(url,page,ID)   
{
		document.myform1.page.value = page;
		document.myform1.ID.value = ID;
		document.myform1.action = url;
		document.myform1.submit();
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goModd      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goModd(url,ID)   
{
		document.myform.sCMD.value = "edit";
		document.myform.action = url;
		document.myform.MessID.value = ID;
		document.myform.submit();
}



//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goRefresh      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goRefresh(url)   
{
		document.myform.sCMD.value = "";
		document.myform.action=url;
		document.myform.submit();
}


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goBack      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goBack(url)   
{
		document.myform1.sCMD.value = "";
		document.myform1.action = url;
		document.myform1.submit();
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goAdd      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goAdd(url)   
{

		document.forms[0].sCMD.value = "add";
		document.forms[0].ID.value = "";
		document.forms[0].action = url;
		document.forms[0].submit();
}


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goAdd1      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goAdd1(url)   
{

		document.myform1.sCMD.value = "add";
		document.myform1.ID.value = "";
		document.myform1.action = url;
		document.myform1.submit();
}


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goVot      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goVot(ID)   
{
		document.myform1.sCMD.value = "vot";
		document.myform1.ID.value =ID;
//		document.myform1.action = url;
		document.myform1.submit();
}


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     doLoginX     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function doLoginX()
{
//	if (document.myform.MemberID.value==0) {
			alert("You have to login in order to access the forums!");
			document.frmTop.MAccountName.focus();
			return false;
//	}	
//		document.myform.ID.value = xID;
//		document.myform.action = "ForumMessages.asp";
//		document.myform.submit( );
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     doLogin     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function doLogin(){
	alert("Trebuie sa faceti login!");
	document.frmTop.MAccountName.focus();
	return false;
}


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     goPost     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function goPost(xParent,xLevel,xThread,xUrl)
{
	document.myform.Parent.value = xParent;
	document.myform.Level.value = xLevel;
	document.myform.Thread.value = xThread;
	document.myform.xFrom.value = xUrl;
	document.myform.action = "ForumMessagePost.asp";
	document.myform.submit( );

}




function AddFavorite()
{
	if ((navigator.platform!="MacPPC") &&	(navigator.appName=="Microsoft Internet Explorer") &&	(navigator.appVersion>="4")) {
	document.write("<A HREF='Javascript:window.external.")
	document.write("AddFavorite(location.href,document.title)'>")
	document.write("Add my site to your Favorites</A>")
	}
}

function ViewProfile(MemberID,MFirstName,MMiddleName,MLastName,MEmail) {
//	MyWin=open("","MyWindow","weight=150,height=150,status=no,toolbar=no,menubar=no");

//	MyWin.document.open();
	MyWin = this.open("", "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=350,height=200,top=50,left=50");

	MyWin.document.write("<html><head><title>View Profile");
	MyWin.document.write("</title></head><body bgcolor='#f5f5f5' >");
	MyWin.document.write("<center><table bgcolor='#f5f5f5' >");
	MyWin.document.write("<tr><td width=100% colspan=2 height=25><font face=verdana size=2 color='black'><b>Member Profile:</b></font></td>");
	MyWin.document.write("<tr><td width=35%><font face=verdana size=2 color='black'>Name:</font></td><td width=65%><font face=verdana size=2 color='darkred'>" + MFirstName+" " + MMiddleName+" " + MLastName + "</font></td>");
	MyWin.document.write("<tr><td width=35%><font face=verdana size=2 color='black'>Email:</font></td><td width=65%><font face=verdana size=2 color='darkred'>" + MEmail +" " + "</font></td>");
	MyWin.document.write("</table></center>");
	MyWin.document.write("</body></html>");
	MyWin.document.close();
}


function PrintThis(text){
	text=document
	print(text)
}


function  checkOpt(){
 		document.myform.MMailing.checked=true;
}


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~      getExtension      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function getExtension(field) {
	var xpos =0;
	var xlen =field.length;
	for (var i=xlen; i > 0 ; i--) {
		temp = "" + field.substring(i, i-1);
		if (temp != ".") {xpos--;}
			else {break;
		}
	}
	var xx =field.substring(xlen+xpos, xlen).toLowerCase();
	return (xx);
	
}

function checkImage(loc) {
	loc = "include/image-popup.html?" + loc;
	windowprops = 'menubar=0,toolbar=0,status=0,location=0 ,width=600,height=600,top=20,left=20';
	popupWindow = open(loc, 'previewWin', windowprops);
	if (popupWindow.opener == null) 
	popupWindow.opener = self;
}

function checkImage2(loc) {
	loc = "include/image-popup2.html?" + loc;
	windowprops = 'menubar=0,toolbar=0,status=0,location=0 ,width=600,height=600,top=20,left=20';
	popupWindow = open(loc, 'previewWin', windowprops);
	if (popupWindow.opener == null) 
	popupWindow.opener = self;
}


function OpenP(page) {
	OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes,width=350,height=600,top=10,left=10");
	return true;
}

function Open(page) {
	OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes,width=850,height=300,top=10,left=10");
	return true;
}

function OpenImg(page) {
	OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes,width=800,height=400,top=2,left=2");
	return true;
}

function StartDetails(page) {
	OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes,width=800,height=600,top=2,left=50");
	return true;
}

function Details(page) {
	OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes,width=990,height=400, top=2,left=10");
	return true;
}


function PhDetails(page) {
	OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes,width=750,height=500, top=30,left=10");
	return true;
}

function Start(page) {
	OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes ,width=650,height=350,top=100,left=100");
}

function OpenA(page) {
	OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=yes ,width=450,height=700,top=100,left=100");
}

function ovrRow(eItem)
{
	eItem.DefaultBgColor=eItem.style.backgroundColor;
	eItem.style.backgroundColor="#FFFDE6";	
	eItem.style.cursor="hand"
}

function outRow(eItem)
{
	eItem.style.backgroundColor=eItem.DefaultBgColor;
	eItem.style.cursor="hand"
}

function ovrTD(Item,col_mover)
{
	Item.style.backgroundColor=col_mover;	
	Item.style.cursor="hand"
}

function outTD(Item,col_mout)
{
	Item.style.backgroundColor=col_mout; 
	Item.style.cursor="hand"
}




//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     CheckAll      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function CheckAll(theForm){
	for (i=0; i<theForm.length; i++){
		if(theForm.elements[i].type == "checkbox") {theForm.elements[i].checked = true; }			
	}
	return true;
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~     UnCheckAll      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function UnCheckAll(theForm){
	for (i=0; i<theForm.length; i++){
		if(theForm.elements[i].type == "checkbox") {theForm.elements[i].checked = false; }			
	}
	return true;
}

