function right(e) {
var msg = "Welcome to BIBAK.net.";
if (navigator.appName == 'Netscape' && e.which == 3) {
alert(msg);
return false;
}
if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
alert(msg);
return false;
}
else return true;
}

function trap() 
  {
  if(document.images)
    {
    for(i=0;i<document.images.length;i++)
      {
      document.images[i].onmousedown = right;
      document.images[i].onmouseup = right;
      }
    }
  }
 
function isBadWord(txt){
     var a = new Array(22);
	a[0]=" IYOT";
	a[1]="FUCK";
	a[2]=" RA RUPAM";
	a[3]=" TAIM ";
	a[4]="SHIT";
	a[5]=" OKEM ";
	a[6]=" OKIM ";
	a[7]=" OKINNAM ";
	a[8]=" OKENNAM ";
	a[9]=" LUKDIT";
	a[10]="OKI INAM";
	a[11]="OKI NI INAM";
	a[12]="TA RUPAM";
	a[13]="TA ROPAM";
	a[14]="DEMONYO KA";
	a[15]="IKAW DEMONYO";
	a[16]="TAKKI";
	a[17]=" AHIHI";
	a[18]=" ASSHOLE";
	a[19]=" ASS ";	
	a[20]=" HEHE";
	a[21]=" HEHEHE";
	
	txt = txt.toUpperCase();
	
	for (i=0;i<22;i++){
		//alert(txt.search(a[i]));
		if (txt.search(a[i]) > -1){
			alert("Sorry, can\'t accept bad word. - " + a[i] + "\n\n" + "Please check wordings again.");
			return (true);
			break;
		}
		//else
		// 	return (false);
	}
}

function isEmailAddr(email){
   var result = false;
   if (email.length > 3){
     var theStr = new String(email);
     var index = theStr.indexOf("@");
     if (index > 0){
         var pindex = theStr.indexOf(".",index);
         if ((pindex > index+1)&&(theStr.length > pindex+1))
         result = true;
     }
    }
    return result;
}

function veryLongWord(s)
{
	var whitespace = " \n\t\r";
	var i;
	var countChar = 0;
	for (i = 0; i < s.length; i++)
	{
		var c = s.charAt(i);
		countChar ++;
		if (countChar > 40){
		 	return true;		
		 }
		if (whitespace.indexOf(c) != -1){
			countChar = 0;
		} 
	}
//	alert("ok all clear");
	return false;	
}

function getCookieVal (offset) 
   {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1)
      endstr = document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
   }

function GetCookie (name) 
   {
   var arg = name + "=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen) 
      {
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg)
         return getCookieVal (j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0) break; 
      }
   return null;
   }

function DisplayName() {
   if(GetCookie('Role') != null)
   		if (GetCookie('Role') == "Spectator"){
      		alert("Welcome back "+GetCookie('Username')+"\n\nSorry, but your role as of the moment has been reduced to\n'"
      		+ GetCookie('Role') + "' as a result of violating some site rules.\n\n"
      		+ "Should you wish to regain your previous ability to post, you have\n"
      		+ "to send request to any of the designated moderators of this section."
      		+ "\n\nSpectator role may surf the site but not allowed to post.\n"
      		+ "Come, join us and have a good day!");
      		//document.frmReply.btnPostResponse.disabled=true;
		return (false);
      		}
   //else
     // alert("You must set the cookie first.");
}


function isDigit(c){
	return ((c >= "0") && (c <="9"))
}

function isEmpty(s){
	return ((s == null)||(s.length ==0))
}

function isInteger(s) {
	var i;
	if (isEmpty(s))
		if (isInteger.arguments.length == 1) return false; //defaultEmptyOK;
		else return (isInteger.arguments[1] == true);
		
	for (i = 0; i < s.length; i++) {
		// check that current char is number
		var c = s.charAt(i);
		
		if (!isDigit(c)){
			//alert("Only digits are allowed.");
			//document.frmVerify.txtVerification.focus;
			return false;
		}
	}
	return true;
}

function beb(txt){
//Enter desired vertical text:
var myverticaltext='<div class="verticaltext">' + txt + '</div>'

var bodycache=document.body
if (bodycache && bodycache.currentStyle && bodycache.currentStyle.writingMode)
document.write(myverticaltext)

}
