
//<!---------------------------------+
//  Developed by Roshan Bhattarai
//  Visit http://roshanbh.com.np for this script and more.
//  This notice MUST stay intact for legal use
// --------------------------------->
$(document).ready(function()
{
	$("#m_name").blur(function()
	{
		//remove all the class add the messagebox classes and start fading
		$("#msgbox").removeClass().addClass('messagebox').text('جاري جلب البيانات').fadeIn("slow");
		//check the username exists or not from ajax
		$.post("checkuser.php",{ m_name:$(this).val() } ,function(data)
        {
		  if(data=='no') //if username not avaiable
		  {
		  	$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
			{
			  //add message and change the class of the box and start fading
			  $(this).html('الإسم هذا موجود مسبقا. الرجاء إختيار إسم آخر').addClass('messageboxerror').fadeTo(900,1);
			});
          }
		  else
		  {
		  	$("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
			{
			  //add message and change the class of the box and start fading
			  $(this).html('هذا الإسم متاح').addClass('messageboxok').fadeTo(900,1);
			});
		  }

        });

	});
});



<!--
//*********************************
function popUp() {
ray=window.open('index.php?s=bglist ','poppage','toolbar=0,scrollbars=1,location=0,status=0 , menubar=0 ,resizable=1 ,width=500 ,height=320,left=100,top=100 ');}
//-->



// getElementByClass function from http://www.webmasterworld.com/forum91/1729.htm
//Create an array
  var allPageTags = new Array();

  function doSomethingWithClasses(theClass) {
//Populate the array with all the page tags
    var allPageTags=document.getElementsByTagName("*");
//Cycle through the tags using a for loop
    for (var i=0; i<allPageTags.length; i++) {
//Pick out the tags with our class name
      if (allPageTags[i].className==theClass) {
//Manipulate this in whatever way you want
        allPageTags[i].style.display='none';
      }
    }
  }

function Show(ids) {
  doSomethingWithClasses('RBtnTab');

  var obj = document.getElementById(ids);
  if (obj.style.display != 'block') { obj.style.display = 'block'; }
                               else { obj.style.display = 'none'; }
}



function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);
}



function createTarget(aa){
t=screen.height/2-150;
w=screen.width/2-250;
window.open("", aa, "toolbar=no,directories=no,status=no,scrollbars=auto,menubar=no,width=500,height=100,top="+t+",left="+w+"");
return true;
}


var newwindow;
function pop(url,thename)
{
t=screen.height/2-150;
w=screen.width/2-250;
	newwindow=window.open(url,"thename","toolbar=no,directories=no,status=no,scrollbars=auto,menubar=no,width=500,height=300,top="+t+",left="+w+"");
	if (window.focus) {newwindow.focus()}
}





var win= null;
function OpenNewWindow(mypage,w,h,myname){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
settings='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=no,toolbar=no'
win=window.open(mypage,myname,settings)
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
// end script here -->






function ahah(url, target) {
  document.getElementById(target).innerHTML = 'جاري تحميل الصفحة.......';
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req != undefined) {
    req.onreadystatechange = function() {ahahDone(url, target);};
    req.open("GET", url, true);
    req.send("");
  }
}

function ahahDone(url, target) {
  if (req.readyState == 4) { // only if req is "loaded"
    if (req.status == 200) { // only if "OK"
      document.getElementById(target).innerHTML = req.responseText;
    } else {
      document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText;
    }
  }
}

function load(name, div) {
	ahah(name,div);
	return false;
}






//Set up variables
var xmlhttp ;
var thediv;
function LoadPage(page,usediv) {
         // Set up request varible
         try {xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");}  catch (e) { alert("Error: Could not load page.");}
         //Show page is loading
         document.getElementById(usediv).innerHTML = 'Loading Page...';
         //scroll to top
         scroll(0,0);
         //Store div in use
         thediv = usediv;
         //send data
         xmlhttp.onreadystatechange = ShowPage;
         xmlhttp.open("GET", page);
         xmlhttp.send(null);
         //Stop any link loading normaly
         return false;
}
function ShowPage(){
         //Check page is completed and there were no problems.
         if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
                //Write data returned to page
                document.getElementById(thediv).innerHTML = xmlhttp.responseText;
         }
}
