	function confirmAdd()
	{
	var agree=confirm("Are you sure you want to add this record?");
	if (agree)
		return true ;
	else
		return false ;
	}
	
	function confirmUpdate()
	{
	var agree=confirm("Are you sure you want to update this record?");
	if (agree)
		return true ;
	else
		return false ;
	}
	
	function confirmDelete()
	{
	var agree=confirm("Are you sure you want to delete this record?");
	if (agree)
		return true ;
	else
		return false ;
	}
	function confirmDeletegamecat()
	{
	var agree=confirm("هل أنت متأكد من الحذف, سوف يتم أيضاً حذف جميع الماريات التابعة لهذا التصنيف");
	if (agree)
		return true ;
	else
		return false ;
	}
	
	
	
	function fillDoubleSelect()
	{
	var oSelects = document.body.getElementsByTagName("SELECT");
	var oSelects_length = oSelects.length;
	for(var i=0; i<oSelects_length; i++){
		if(oSelects[i].multiple){
			// a multiple select box
			if(oSelects[i].name.indexOf('source_')==0){
				var sDest = oSelects[i].name.substring(7, oSelects[i].name.length);
				eval("var oDest = document.getElementsByName('" + sDest + "')[0];");
				moveSelectedOptions(oSelects[i], oDest);
			}
		}
	}
	return true;
	}

/////////////////Double Select Start//////////////////////////////////	
/*
	Name		=	moveSelectedOptions
	Module		=	DoubleSelect
	Version		=	1.2
*/

function moveSelectedOptions(oSel1, oSel2)
{
	if(!copySelectedOptions(oSel1, oSel2) || !deleteSelectedOptions(oSel1, oSel2)){
		return false;
	}
	
	if(String(oSel1.name).indexOf("source_")==-1){
		for(var i=0; i<oSel1.length; i++){
			oSel1.options[i].selected=true;
		}
	}
	if((String(oSel2.name).indexOf("source_"))==-1){
		for(var i=0; i<oSel2.length; i++){
			oSel2.options[i].selected=true;
		}
	}
	return true;
}

/*
	Name		=	deleteSelectedOption
	Module		=	DoubleSelect
	Version		=	1.1
*/

function deleteSelectedOptions(oSel)
{
	var oArray = getSelectedOptions(oSel);
	for(var i=0; i<oArray.length; i++){
		if(!delSelectOption(oSel, oArray[i])){
			return false;
		}
	}
	return true;
}


// Add a new option to a select element
function addOption(selectElement,newOption) {
  // First try the DOM2 method ...
  try {
   selectElement.add(newOption,null);
  }
  // ... And if that doesn't work use the IE-only method
  catch (e) {
    selectElement.add(newOption,selectElement.length);
  }
} 
function getSelectOption(oSelect, value, sDisplay, nIndex){
	var i;
	if (value){
		for (i=0;i<oSelect.length;i++){
			if(value==oSelect.options[i].value){
				return oSelect.options[i];
			}
		}
	}
	if(sDisplay){
		for (i=0;i<oSelect.length;i++){
			if (sDisplay==oSelect.options[i].text){
				return oSelect.options[i];
			}
		}
	}
	if (nIndex>-1 && nIndex<oSelect.length){
		return oSelect.options[nIndex];
	}
	return null;
}

function copyOption2Select(oSel1, oSel2, oOption)
{
	// first check to see if oOption is really in oSel1
	if(!getSelectOption(oSel1, oOption.value, oOption.text, null)){
		// option not in the select control.
		return false;
	}
	// copy to the destination select
	var newOption = document.createElement("OPTION");
	newOption.text = oOption.text;
	newOption.value = oOption.value;
	if((String(oSel1.name).indexOf("source_"))!=-1){
		newOption.selected = true; //new addition to the double select by abed for bta
	}
	addOption(oSel2,newOption);
	return true;
}

function copySelect2Select(oSel1, oSel2)
{
	var oSel1_length = oSel1.length;
	for(var i=0; i<oSel1_length; i++){
		if(!copyOption2Select(oSel1, oSel2, getSelectOption(oSel1, null, null, i))){
			return false;
		}
	}
	return true;
}

function delSelectOption(oSelect, oOption)
{
	for(var i=0; i<oSelect.length; i++){
		if(getSelectOption(oSelect, null, null, i)==oOption){
			oSelect.remove(i);
			return true;
		}
	}
	return false;
}

function copySelectedOptions(oSel1, oSel2)
{
	var oOption;
	for(var i=0; i<oSel1.length; i++){
		oOption = getSelectOption(oSel1, null, null, i);
		if(oOption.selected){
			copyOption2Select(oSel1, oSel2, oOption);
		}
	}
	// there is no way this function can fail.
	return true;
}

function clearSelect(oSel)
{
	while(oSel.length>0){
		if(!delSelectOption(oSel, getSelectOption(oSel, null, null, 0))){
			return false;
		}
	}
	return true;
}

/*
	Name		=	getSelectedOptions
	Module		=	DoubleSelect
	Version		=	1.0
*/
function getSelectedOptions(oSel)
{
	var oArray = new Array();
	for(var i=0; i<oSel.length; i++){
		oOption = getSelectOption(oSel, null, null, i);
		if(oOption.selected){
			oArray[oArray.length] = oOption;
		}
	}
	return oArray;
}

/*
	Name		=	moveSelectedOptions
	Module		=	DoubleSelect
	Version		=	1.2
*/

function moveSelectedOptions(oSel1, oSel2)
{
	if(!copySelectedOptions(oSel1, oSel2) || !deleteSelectedOptions(oSel1, oSel2)){
		return false;
	}
	
	if(String(oSel1.name).indexOf("source_")==-1){
		for(var i=0; i<oSel1.length; i++){
			oSel1.options[i].selected=true;
		}
	}
	if((String(oSel2.name).indexOf("source_"))==-1){
		for(var i=0; i<oSel2.length; i++){
			oSel2.options[i].selected=true;
		}
	}
	return true;
}

/*
	Name		=	deleteSelectedOption
	Module		=	DoubleSelect
	Version		=	1.1
*/

function deleteSelectedOptions(oSel)
{
	var oArray = getSelectedOptions(oSel);
	for(var i=0; i<oArray.length; i++){
		if(!delSelectOption(oSel, oArray[i])){
			return false;
		}
	}
	return true;
}

function fixOnSubmit()
{
	var oSelects = document.body.getElementsByTagName("SELECT");
	var oSelects_length = oSelects.length;
	for(var i=0; i<oSelects_length; i++){
		if(oSelects[i].multiple){
			// a multiple select box
			if(oSelects[i].name.indexOf('source_')==0){
				var sDest = oSelects[i].name.substring(7, oSelects[i].name.length);
				eval("var oDest = document.getElementsByName('" + sDest + "')[0];");
				for(var j=0; j<oDest.options.length; j++){
					oDest.options.item(j).selected = true;
				}
			}
		}
	}
	return true;
}

function fillDoubleSelect()
{
	var oSelects = document.body.getElementsByTagName("SELECT");
	var oSelects_length = oSelects.length;
	for(var i=0; i<oSelects_length; i++){
		if(oSelects[i].multiple){
			// a multiple select box
			if(oSelects[i].name.indexOf('source_')==0){
				var sDest = oSelects[i].name.substring(7, oSelects[i].name.length);
				eval("var oDest = document.getElementsByName('" + sDest + "')[0];");
				moveSelectedOptions(oSelects[i], oDest);
			}
		}
	}
	return true;
}
/////////////////Double Select End//////////////////////////////////


<!-------------------images Swap Start----------------------->

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
x.src=x.oSrc;
}

function Pop2(URL2,title2) {
   window.open(URL2,title2, "height=450,width=550,titlebar=no,toolbar=no,status=no,scrollbars=no,resizable=no");
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; 
i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; 
d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; 
if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) 
x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; 
for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) 
x.oSrc=x.src; x.src=a[i+2];}
}


function PopupImage(img,name) {
	titre="";
	w=open("",'image','width=512,height=400,toolbar=no,scrollbars=no,resizable=yes');	
	w.document.write("<HTML><HEAD><TITLE>"+name+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+30); window.focus();} else { setTimeout('check()',500) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src='"+img+"' border=0>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

//
function swapimg(dest,tail,name) {
separateur=dest.lastIndexOf("photos");
fin=dest.length;
page=dest.substring(separateur,fin);
destination="photos/"+page;
document.getElementById("imagegd").innerHTML="<a href=\"javascript:PopupImage('"+dest+"','"+name+"')\"><img src='"+dest+"' "+tail+" border=0></a>";
}
function swapimg1(dest,tail,name) {
separateur=dest.lastIndexOf("photos");
fin=dest.length;
page=dest.substring(separateur,fin);
destination="photos/"+page;
document.getElementById("imagegd").innerHTML="<img src='"+dest+"' "+tail+" border=0>";
}
<!-------------------images Swap End----------------------->
function fav_SubmitDelete(NForm){
	NForm.action.value=1;
	NForm.submit();
}
function fav_SubmitHire(NForm){
	NForm.action.value=2;
	NForm.submit();
}
function fav_SubmitRole(NForm,role){
	NForm.mode.value=role;
	NForm.submit();
}
function display_ShowHide(id,type) {
	var target = document.getElementById(id);
	var all = document.getElementsByTagName(type);
	if (target.style.display == '') {
 		target.style.display = 'none';          
   		return true;
	}
	for (var i = 0; i < all.length; i++) { 
 		all[i].style.display = "none";
	} 
	if (target.style.display == "none") {
 		target.style.display = '';          
	}
}

/////////////////////////////////////////

/////////Start Create Layer Function/////////
	function toggleBox(szDivID, iState) // 1 visible, 0 hidden
	{
	   var obj = document.layers ? document.layers[szDivID] :
	   document.getElementById ?  document.getElementById(szDivID).style :
	   document.all[szDivID].style;
	   obj.visibility = document.layers ? (iState ? "show" : "hide") :
	   (iState ? "visible" : "hidden");

	   
	}


////////////////////////////////////////////
////////add More inputs/////////
var arrInput = new Array(0);
  var arrInputValue = new Array(0);

function addInput() {
  arrInput.push(arrInput.length);
  arrInputValue.push("");
  display();
}

function display() {
  document.getElementById('parah').innerHTML="";
  for (intI=1;intI<arrInput.length;intI++) {
    document.getElementById('parah').innerHTML+=createInput(arrInput[intI], arrInputValue[intI]);
  }
}

function saveValue(intId,strValue) {
  arrInputValue[intId]=strValue;
}  

function createInput(id,value) {
  return "<tr></td><input type='text' id='test "+ id +"' onChange='javascript:saveValue("+ id +",this.value)' value='"+ value +"'></td></tr>";
}

function deleteInput() {
  if (arrInput.length > 0) { 
     arrInput.pop(); 
     arrInputValue.pop();
  }
  display(); 
}



//////////////////////////////

////////Countries cities/////////
var lastDiv = "";
function showDiv(divName) {
	// hide last div
	if (lastDiv) {
		document.getElementById(lastDiv).className = "hiddenDiv";
	}
	//if value of the box is not nothing and an object with that name exists, then change the class
	if (divName && document.getElementById(divName)) {
		document.getElementById(divName).className = "visibleDiv";
		lastDiv = divName;
	}
}

function hideDiv(divName) {
	// hide last div
	if (divName) {
		document.getElementById(divName).className = "hiddenDiv";
	}
	
}