// JavaScript Document
function checkIfAllow(totalNum)
{
	
	if(document.getElementById('aright').checked==true)
	{
		if(totalNum>=7)
		{
			alert('You cant add more 7 links in main menu');
			document.getElementById('aright').checked=false;
		}
	}
}

function checkIfAllowFooter(totalNum)
{
	
	if(document.getElementById('afooter').checked==true)
	{
		if(totalNum>=7)
		{
			alert('You cant add more 7 links in Footer menu');
			document.getElementById('afooter').checked=false;
		}
	}
}


function setheightValue(id,idWidth)
{
		var height=parseInt(document.getElementById(idWidth).value/1.3333);
		document.getElementById(id).value=height;
}
function confirmDeletionDb(dbDropvalue)
{
	var msg='';
	msg=confirm("Are You Sure ,You Want Drop DataBase");
	if(msg==true)
	{
		document.getElementById('dbDrop').value=dbDropvalue;
		deleteUser.submit();
	}
}
function confirmDeletion(webName,useName)
{
	var msg='';
	msg=confirm("Are You Sure ,You Want Delete this User");
	if(msg==true)
	{
		document.getElementById('webNameUser').value=webName;
		document.getElementById('UserName').value=useName;
		deleteUser.submit();
	}
		  
}
function checkWebNames(names)
{
		var listed=names.split(',');
		for(var i=0;i<(listed.length)-1;i++)
		{
			if(listed[i].toLowerCase()==document.getElementById('title').value.toLowerCase())
			{
				alert('Please Need New WebName , This Name Has Been used Before or reserved');
				document.getElementById('title').value='';
				document.getElementById('dbName').value='';
				document.getElementById('title').focus();
				
			}
		}
		var pattern=new RegExp(" ");
		var val=pattern.exec(document.getElementById('title').value);
		if (val!=null)
		{
			alert('Please Need New WebName not containing spaces');
			document.getElementById('title').value='';
			document.getElementById('dbName').value='';
			document.getElementById('title').focus();
		}
}
function filldbName()
{
	document.getElementById('dbName').value=document.getElementById('title').value;
}
function testB(id,data)
{
 if(document.getElementById("dummper"+id).innerHTML=='')
 document.getElementById("dummper"+id).innerHTML=data;
 else
 document.getElementById("dummper"+id).innerHTML='';
}



function goToMainSit()
{
	window.location='../admin';
}
function redirectLoginPage()
{
	window.location='../'+document.getElementById('websiteTitle').value+'/admin';
}
// JavaScript Document
function testSign(idTd,spanId,fuId)
{
    var data = document.getElementById(fuId).value;
    document.getElementById(fuId).style.display = '';
	document.getElementById(spanId).innerHTML="<img src=images/nav_minus.png width=16 height=16 onclick=emptySignField('"+idTd+"','"+spanId+"','"+fuId+"') >";
	//document.getElementById(idTd).innerHTML=data;
}
function emptySignField(idTd,spanId,fuId)
{
	//alert(data);
    //onclick=testSign('+idTd+','+data+','+spanId+')
    document.getElementById(fuId).style.display = 'none';
	document.getElementById(spanId).innerHTML="<img src=images/nav_plus.png width=16 height=16 onclick=testSign('"+idTd+"','"+spanId+"','"+fuId+"')>";
	//document.getElementById(idTd).style.visibility='hidden';
	document.getElementById(idTd).innerHTML='';
}

function testA(data,e,lang)
{
	var height=200;
if (navigator.appName == "Microsoft Internet Explorer")
{
		var x_pos=event.screenX+document.body.scrollLeft;
		//alert(document.documentElement.scrollTop);
		var y_pos=event.screenY+document.documentElement.scrollTop-260;
}
else
{
	//alert((screen.height-e.clientY));
		var x_pos=e.clientX;
		var y_pos=e.screenY+document.documentElement.scrollTop-270;

}
if(lang=='AR')
	document.getElementById("vrMenu").style.right=255+'px';
else
	document.getElementById("vrMenu").style.left=300+'px';
document.getElementById("vrMenu").style.top=y_pos+'px';
document.getElementById("vrMenu").style.visibility='visible';
document.getElementById("vrMenu").innerHTML=data;

	//document.getElementById("vrMenu").style.visibility='visible';
//	document.getElementById("vrMenu").innerHTML=data;
}
function hideVr()
{
		setTimeout("hideNow()",15000); 
}
function hideNow()
{
		document.getElementById("vrMenu").style.visibility='hidden';
}
function disableHide()
{
		document.getElementById("vrMenu").style.visibility='visible';
}
function editRootLevelData(id,rootName,rootDesc,rootOrder)
{	

	var content='';
	content='<form name=editRootLevel id=name=editRootLevel method=post action=?module=home&opr=edit_root_sub_level>';
	content+='<table border=0 cellpadding=2 cellspascing=2 width=95%>';
	content+='<tr><td class=normal_text><input type=hidden name=id id=id size=40 value='+id+'></td></tr>';
	content+='<tr><td class=normal_text>Level Name:</td><td><input type=text name=child_name id=child_name size=40 value="'+rootName+'"></td></tr>';
	content+='<tr><td class=normal_text>Description:</td><td><textarea name=description id=description rows=15 cols=100 >'+rootDesc+'</textarea></td></tr>';
	content+='<tr><td class=normal_text>Data Order:</td><td><input type=text name=data_order id=data_order size=6 value="'+rootOrder+'"></td></tr>';
	content+='<tr><td></td><td><input type=submit value=update  name=update /></td></tr>';
	content+='</table>';
	content+='</form>';
	document.getElementById("levelRoot_"+id).innerHTML=content;
}
function setLang()
{
	//alert(1);
	window.location='index.php@lang='+document.getElementById("languages").value+'&module=home&changed=1';
}
function submitForm()
{
	document.getElementById("searchForm").submit();
}
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}
//general varible
var http = createObject();
//=======
//announcment
var c=1;
function startAnnoun()
{
	var nocache = Math.random();
	http.open('GET', '@module=announcments&nocache='+nocache,true);
	http.onreadystatechange = changAnnoun;
	http.send('');
}
function changAnnoun()
{
if(http.readyState == 4){	
var response = http.responseText;

// else if login is ok show a message: "Site added+ site URL".
document.getElementById('announ').innerHTML =response;
	setTimeout("startAnnoun()",8000); 

}
}
//


function testIcons(id,moduleName)
{
document.getElementById("icons"+id).innerHTML="<a href=@module="+moduleName+"><img src=icons/"+moduleName+"_hvr.jpg width=48 height=48 border=0 onmouseout=testIconsRem('"+id+"','"+moduleName+"') /></a>";
}
function testIconsRem(id,moduleName)
{	
document.getElementById("icons"+id).innerHTML="<img src=icons/"+moduleName+".jpg width=48 height=48 onmouseover=testIcons('"+id+"','"+moduleName+"') />";
}
//ajax changing home page news
function ajaxNewsChang(id)
{
	var nocache = Math.random();
	http.open('GET', 'test.php@news_id='+id+'&nocache='+nocache,true);
	http.onreadystatechange = changNews;
	http.send('');

}
//ajax change loglo
function changNews()
{
if(http.readyState == 4){	
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('main_data').innerHTML =response;
}
}

function ajaxChangData(module)
{
	var nocache = Math.random();
	http.open('GET', 'ajaxData.php@ajaxModule='+module+'&nocache='+nocache,true);
	http.onreadystatechange = changAjaxModule;
	http.send('');
}
//ajax change loglo
function changAjaxModule()
{
if(http.readyState == 4){	
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('ajaxData').innerHTML =response;
}
}
//ajax change loglo
function logos()
{
	//window.setTimeout("changeLogo()",4000);
	//reload = setTimeout("changeLogo()", 4000);
	//changeLogo();
}
function changeLogo()
{
	nocache = Math.random();
	var openPage=http.open('GET', 'logo.php@NoCashe='+nocache,true);
	//http.open('GET', '../../www.almanager.biz/souq/logo.php',true);
	http.onreadystatechange = getLogoResult;
	http.send(null);
	//logos();
	

}
function getLogoResult() {
if(http.readyState == 4){	
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('logo').innerHTML =response;
reload = setTimeout(changeLogo, 4000);
}
}

//ajax for search
function checkMainData()
{
	escape() ;
	var searchValue=document.getElementById("searchValue").value;
	//document.getElementById("mainDataId").innerHTML=;
		//http.decode(searchValue, "ISO-8859-1") ;

	http.open('GET', 'search.php@searchValue='+searchValue,true);
   	http.onreadystatechange = getSearchResult;
	http.send("");
		return false;

}
//calling ajax approve sending edit
function getSearchResult() {
if(http.readyState == 4){	
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('main_data').innerHTML =response;
//alert(1);
}
}
//
//ajax function to allow customer to add topic form 
//verfiy function adding data and confirm addind and calling ajax function
function stepsToAddClientTopic()
{
	if(document.getElementById("dataTitle").value=="")
	{
		document.getElementById("dataTitleRequired").innerHTML="Required Field Title Missing";
		document.getElementById("dataTitle").focus();
		return false;
	}
	if(document.getElementById("image").value=="")
	{
		document.getElementById("dataTitleRequired").innerHTML="";
		document.getElementById("imageRequired").innerHTML="Required Field Image Missing";
		document.getElementById("image").focus();
		return false;
	}
	if(document.getElementById("description").value=="")
	{
		document.getElementById("dataTitleRequired").innerHTML="";
		document.getElementById("imageRequired").innerHTML="";
		document.getElementById("descriptionRequired").innerHTML="Required Field Desription Missing";
		document.getElementById("description").focus();
		return false;
	}
	var msg='';
	msg=confirm("Are You Sure ,You Want To Add this Information?");
	if(msg==true)
	{
		addingTopic.submit();
	}
	
}

//ajax function to allow publisher to add topic
function confirmAddingDataRootModule(id)
{
	var addingData='';
	var word='Next form';
	addingData='<form  id=approveEditing  name=approveEditing method=post action=javascript:viewForm('+id+',"module")>';
	addingData+='<table border=0>';
	addingData+='<tr><td colspan=2 align=center><input type=submit name=send value='+word+' /></td></tr>';
	addingData+='</table>';
	addingData+='</form>';
document.getElementById(id).innerHTML = addingData;
}
//ajax function to allow publisher to add topic
function confirmAddingDataChildModule(id)
{
	var addingData='';
	var word='Next form';
	addingData='<form  id=approveAddingChilde  name=approveAddingChilde method=post action=javascript:viewFormChilde('+id+',"childe")>';
	addingData+='<table border=0>';
	addingData+='<tr><td colspan=2 align=center><input type=submit name=send value='+word+' /></td></tr>';
	addingData+='</table>';
	addingData+='</form>';
document.getElementById("child_"+id).innerHTML = addingData;
}
//calling ajax adding form accourding to id and type if its root or childe
function viewFormChilde(id,type) {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById("addingFormViewChilde").innerHTML = "Just a second...";
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable 
http.open('GET', 'buildAddingForm.php@id='+id+'&type='+type,true);
http.onreadystatechange = addingFormChilde;
http.send("");
}
//calling ajax approve sending edit
function addingFormChilde() {
if(http.readyState == 4){	
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('mainDataId').innerHTML =response;
}
}
//calling ajax adding form accourding to id and type if its root or childe
function viewForm(id,type) {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById("addingFormView").innerHTML = "Just a second...";
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable 
http.open('GET', 'buildAddingForm.php@id='+id+'&type='+type,true);
http.onreadystatechange = addingForm;
http.send("");
}
//calling ajax approve sending edit
function addingForm() {
if(http.readyState == 4){	
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('mainDataId').innerHTML =response;
}
}
////adding topic areq
function showModules() {
// Optional: Show a waiting message in the layer with ID login_response
//var viewForm=document.getElementById("viewForm");
//viewForm.innerHTML = "Just a second...";
// Set te random number to add to URL request
var nocache = Math.random();
// Pass the login variables like URL variable 
http.open('GET', 'getModuleList.php',true);
http.onreadystatechange = moduleList;
http.send("");
}
//calling ajax approve sending edit
function moduleList() {
if(http.readyState == 4){	
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('mainDataId').innerHTML =response;
}
}
///=====================approve adding topic
function approveAddingByClient(rowId)
{
		var EditingUsers='';
		EditingUsers='<form  id=approveEditing  name=approveEditing method=post action=javascript:approveNewAdding('+rowId+',"root")>';
		EditingUsers+='<table border=0>';
		EditingUsers+='<tr><td colspan=2 align=center><input type=submit name=send value=Approve /></td></tr>';
		EditingUsers+='</table>';
		EditingUsers+='</form>';
		EditingUsers+='<form  id=deleteEditing  name=deleteEditing method=post action=javascript:deleteNewAdding('+rowId+')>';
		EditingUsers+='<table border=0>';
		EditingUsers+='<tr><td colspan=2 align=center><input type=submit name=trash value=Trash /></td></tr>';
		EditingUsers+='</table>';
		EditingUsers+='</form>';
		document.getElementById("approveAdding_"+rowId).innerHTML=EditingUsers;
}
function approveAddingByClientSubLevel(rowId)
{
		var EditingUsers='';
		EditingUsers='<form  id=approveEditing  name=approveEditing method=post action=javascript:approveNewAdding('+rowId+',"childe")>';
		EditingUsers+='<table border=0>';
		EditingUsers+='<tr><td colspan=2 align=center><input type=submit name=send value=Approve /></td></tr>';
		EditingUsers+='</table>';
		EditingUsers+='</form>';
		EditingUsers+='<form  id=deleteEditing  name=deleteEditing method=post action=javascript:deleteNewAdding('+rowId+')>';
		EditingUsers+='<table border=0>';
		EditingUsers+='<tr><td colspan=2 align=center><input type=submit name=trash value=Trash /></td></tr>';
		EditingUsers+='</table>';
		EditingUsers+='</form>';
		document.getElementById("approveAddingSubLevel_"+rowId).innerHTML=EditingUsers;
}
//calling ajax approve editing function
function approveNewAdding(rowId,type,side) {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById("approved_response").innerHTML = "Just a second...";
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable 
if(type=="root")
{
	if(side=="1")
	http.open('get', 'index.php@module=user_managment&step=approveAdding&id='+rowId+'&nocache ='+nocache);
	else
	http.open('get', 'admin/index.php@module=user_managment&step=approveAdding&id='+rowId+'&nocache ='+nocache);
}
else
{
	if(side=="1")
	{
		http.open('get', '../../localhost/boycott/admin/index.php@module=user_managment&step=approveAddingChilde&id='+rowId+'&nocache ='+nocache);
	}
	else
	{
		http.open('get', '../../localhost/boycott/admin/index.php@module=user_managment&step=approveAddingChilde&id='+rowId+'&nocache ='+nocache);
	}
}
http.onreadystatechange = approveNewAddingReply;
http.send(null);
}
//calling ajax approve sending edit
function approveNewAddingReply() {
if(http.readyState == 4){	
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('approved_response').innerHTML = '<tr><td class=error_msg colspan=2 width=100%>Your Information Has been Sent, Please go and check the apperance for the  article now Thank You</td></tr>';
}
}
function deleteNewAdding(rowId) {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById("approved_response").innerHTML = "Just a second...";
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable 
http.open('get', '../../www.gandone.com/dummy/admin/index.php@module=user_managment&step=deleteNewAdding&id='+rowId+'&nocache ='+nocache);
http.onreadystatechange = approveNewAddingReply;
http.send(null);
}
////ending adding topic
//function to approve ediing
function approveEditingByClient(rowId,side)
{
		EditingUsers='<form  id=approveEditing  name=approveEditing method=post action=javascript:approve('+rowId+',"root",'+side+')>';
		EditingUsers+='<table border=0>';
		EditingUsers+='<tr><td colspan=2 align=center><input type=submit name=send value=Approve /></td></tr>';
		EditingUsers+='</table>';
		EditingUsers+='</form>';
		EditingUsers+='<form  id=deleteEditing  name=deleteEditing method=post action=javascript:deleteEditoers('+rowId+',"childe",'+side+')>';
		EditingUsers+='<table border=0>';
		EditingUsers+='<tr><td colspan=2 align=center><input type=submit name=trash value=Trash /></td></tr>';
		EditingUsers+='</table>';
		EditingUsers+='</form>';
		//if(type=="root")
		//{
		document.getElementById("approveEdit_"+rowId).innerHTML=EditingUsers;
		//}
		///else
		//{
		//document.getElementById("approveEditChilde_"+rowId).innerHTML=EditingUsers;
		//}
}
//function to approve ediing
function approveEditingByClientSubLevel(rowId,side)
{

		EditingUsers='<form  id=approveEditing  name=approveEditing method=post action=javascript:approveNewAdding('+rowId+',"childe",'+side+')>';
		EditingUsers+='<table border=0>';
		EditingUsers+='<tr><td colspan=2 align=center><input type=submit name=send value=Approve /></td></tr>';
		EditingUsers+='</table>';
		EditingUsers+='</form>';
		EditingUsers+='<form  id=deleteEditing  name=deleteEditing method=post action=javascript:deleteSubLevel('+rowId+',"childe",'+side+')>';
		EditingUsers+='<table border=0>';
		EditingUsers+='<tr><td colspan=2 align=center><input type=submit name=trash value=Trash /></td></tr>';
		EditingUsers+='</table>';
		EditingUsers+='</form>';
		//if(type=="root")
		//{
		//document.getElementById("approveEdit_"+rowId).innerHTML=EditingUsers;
		//}
		///else
		//{
		document.getElementById("approveEditChilde_"+rowId).innerHTML=EditingUsers;
		//}
}
var nocache = 0;
//calling trash function
function deleteEditoers(rowId) {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById("approved_response").innerHTML = "Just a second...";
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable 
http.open('get', '../../www.gandone.com/dummy/index.php@module=home&step=deleteEditing&id='+rowId+'&nocache ='+nocache);
http.onreadystatechange = approvedReply;
http.send(null);
}
//calling ajax approve editing function
function approve(rowId,type,side) {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById("approved_response").innerHTML = "Just a second...";
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable 
if(type=="root")
{
	//side==1 is admin side ,side==2 is client side
	if(side=="1")
	http.open('get', '../index.php@module=home&step=approveEditing&id='+rowId+'&nocache ='+nocache);
	else
	http.open('get', 'index.php@module=home&step=approveEditing&id='+rowId+'&nocache ='+nocache);
}
else
{
	if(side=="1")
	http.open('get', 'index.php@module=home&step=approveEditingChilde&id='+rowId+'&nocache ='+nocache);
	else
	http.open('get', 'index.php@module=home&step=approveEditingChilde&id='+rowId+'&nocache ='+nocache);
}
http.onreadystatechange = approvedReply;
http.send(null);
}
//calling ajax approve sending edit
function approvedReply() {
if(http.readyState == 4){	
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('approved_response').innerHTML = '<tr><td class=error_msg colspan=2 width=100%>Your Information Has been Sent, Please go and check the apperance for the  article now Thank You</td></tr>';
}
}
//calling ajav Function
function openEditingArea(module,id,rootModule,level_id,root)
{
			if(rootModule=="")
				rootModule='';
			if(level_id=="")
				level_id='';
				if(root=="")
					root='';
			if(id=="")
				id='0';
				
			/*EditingUsers='<form name=EditingByUser method=post action=index.php?module='+module+'&id='+id+'&rootModule='+rootModule+'&level_id='+level_id+'&step=EditingByUser>';
			EditingUsers+='<table border=0 class=menu><tr><td valign=middle>Insert Your Info:</td>';
			EditingUsers+='<td><textarea rows=5 cols=40 id=editingUserData name=editingUserData></textarea>';
			EditingUsers+='</td></tr>';
			EditingUsers+='<tr><td class=error_msg colspan=2>You Help us to add you info to our articels when you give us the source for your information,its could be from newspaper , internet , books , trusted websites, articels,others</td></tr>';
			EditingUsers+='<tr><td valign=middle>Source:</td>';
			EditingUsers+='<td><input type=text size=40 id=editingUserSource name=editingUserSource />';
			EditingUsers+='</td></tr>';
			EditingUsers+='<tr><td colspan=2 align=center><input type=submit name=send value=send /></td></tr>';
			EditingUsers+='</table></form>';
			document.getElementById("editingUserArea").innerHTML=EditingUsers;*/
			EditingUsers='<form  method=post action=javascript:insert("'+module+'","'+id+'","'+rootModule+'","'+level_id+'","'+root+'")>';
			EditingUsers+='<table border=0 class=menu>';
			EditingUsers+='<tr><td id=insert_response colspan=2></td></tr>';
			EditingUsers+='<tr><td valign=middle>Insert Your Info:</td>';
			EditingUsers+='<td><textarea rows=5 cols=40 id=editingUserData name=editingUserData></textarea>';
			EditingUsers+='</td></tr>';
			EditingUsers+='<tr><td class=error_msg colspan=2>You Help us to add you info to our articels when you give us the source for your information,its could be from newspaper , internet , books , trusted websites, articels,others</td></tr>';
			EditingUsers+='<tr><td valign=middle>Source:</td>';
			EditingUsers+='<td><input type=text size=40 id=editingUserSource name=editingUserSource />';
			EditingUsers+='</td></tr>';
			EditingUsers+='<tr><td colspan=2 align=center><input type=submit name=send value=send /></td></tr>';
			EditingUsers+='</table></form>';
			document.getElementById("editingUserArea").innerHTML=EditingUsers;
}
var nocache = 0;
//calling ajav succsses sending edit
function insert(module,id,rootModule,level_id,root) {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById('insert_response').innerHTML = "Just a second..."
// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
var editingData= encodeURI(document.getElementById('editingUserData').value);
var editingSource = encodeURI(document.getElementById('editingUserSource').value);
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable 
if(module=="level")
{
http.open('get', 'index.php@module='+module+'&id='+id+'&rootModule='+rootModule+'&level_id='+level_id+'&root='+root+'&step=EditingByUser&opr=view_sub_level_details&editingData='+editingData+'&editingSource='+editingSource+'&nocache = '+nocache);
}
else
{
	http.open('get', 'index.php@module='+module+'&id='+id+'&rootModule='+rootModule+'&level_id='+level_id+'&step=EditingByUser&editingData='+editingData+'&editingSource='+editingSource+'&nocache = '+nocache);

}

http.onreadystatechange = insertReply;
http.send(null);
}
function insertReply() {
if(http.readyState == 4){
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('insert_response').innerHTML = '<tr><td class=error_msg colspan=2 width=100%>Your Information Has been Sent,Thank You</td></tr>';
}
}
//dhtml
/*
var i=-135;
var intHide;
var speed=3;
function showmenu()
{
clearInterval(intHide);
intShow=setInterval("show()",10);
clearInterval(intHide);
}
function hidemenu()
{
clearInterval(intShow);
//intHide=setInterval("hide()",10);
	document.getElementById('editingUserArea').style.left=-1000;

}
function show()
{
	if (window.ActiveXObject)
	{
		if (i<-12)
			{
			i=i+speed;
			document.getElementById('editingUserArea').style.left=i;
			}
	}
	// code for Mozilla, Firefox, Opera, etc.
	else if (document.implementation && document.implementation.createDocument)
	{
		if (i<100)
			{
			i=i+speed;
			document.getElementById('editingUserArea').style.left=i;
			}
	}
}
function hide()
{
/*if (i>-1000)
	{
	    i=i-speed;
	    document.getElementById('editingUserArea').style.left=i;
	}
	
		document.getElementById("editingUserArea").innerHTML="dd";
}
//end dhtml*/
function closeEdituserClient()
{
	document.getElementById("UserActivitesRow").innerHTML="";
}
function openEdituserPagecleint(id,userInfo)
{
	//window.open("../includes/updateUsers.php@id="+id,"EditUser","width=400,height=280,top=200,left=250,scrollbars=no");
	document.getElementById(id).innerHTML=userInfo;
}
function closeEdituser(id)
{
	document.getElementById(id).innerHTML="";
}
function openEdituserPage(id,userInfo)
{
	//window.open("../includes/updateUsers.php@id="+id,"EditUser","width=400,height=280,top=200,left=250,scrollbars=no");
	document.getElementById(id).innerHTML=userInfo;
}
function checkcommentForm()
{
if(document.getElementById("commenter_contact_us").value=="")
	{
		alert("please insert comment");
		document.getElementById("commenter_contact_us").focus();
		return false;
	}
		
}
function checknotificationForm()
{
if(document.getElementById("customer_name").value=="")
	{
		alert("please insert name");
		document.getElementById("customer_name").focus();
		return false;
	}
if(document.getElementById("customer_email").value=="")
	{
		alert("please insert email address");
		document.getElementById("customer_email").focus();
		return false;
	}
}
function up()
{
	history.go(-1);
}
function openLoginWindow()
{
window.open("includes/loginForm.php","LoginForm","width=400,height=280,top=200,left=250,scrollbars=no");
}
function candleRedierctLogin()
{
	window.location='../cand.php@offset=0';
}
function testing()
{
	window.location="../index.php@module=register&opr=newUser";
}
function openUploadForm(type)
{
if(type=="admin")
window.open("../includes/uploadform.php@type="+type,"UploadImage","width=400,height=280,top=200,left=250,scrollbars=no");
else
window.open("includes/uploadform.php","UploadImage","width=400,height=280,top=200,left=250,scrollbars=no");
}
/*function show_image(e,image_name,width,height)
{
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			//alert(screen.height-event.screenY);
			if(screen.height-event.screenY>380)
			{
				var x_pos=event.screenX+document.body.scrollLeft;
				var y_pos=event.screenY+document.body.scrollTop;
			}
			else
			{
				var x_pos=event.screenX+document.body.scrollLeft;
				var y_pos=event.screenY+document.body.scrollTop;
			}
		}
		else
		{
		//	alert((screen.height-e.clientY));
			if((screen.height-e.clientY)>600)
			{
				var x_pos=e.clientX+document.body.scrollLeft;
				var y_pos=e.clientY+document.body.scrollTop-20;
			}
			else
			{
				var x_pos='1000';
				var y_pos=e.clientY+document.body.scrollTop-320;
			}
		}
document.getElementById('image_div').style.left=x_pos-width+'px';
document.getElementById('image_div').style.top=y_pos-height+'px';
document.getElementById('image_div').style.visibility='visible';
document.getElementById('image_div').innerHTML="<img src='"+image_name+"' width="+width+" height="+height+" class=empty_border>";
}*/
function show_image(e,image_name,width,height)
{
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			//alert(screen.height-event.screenY);
			if(screen.height-event.screenY>380)
			{
				var x_pos=event.screenX+document.body.scrollLeft;
				var y_pos=event.screenY+document.body.scrollTop;
			}
			else
			{
				var x_pos=event.screenX+document.body.scrollLeft;
				var y_pos=event.screenY+document.body.scrollTop;
			}
			x_pos=x_pos-15;
		}
		else
		{
		//	alert((screen.height-e.clientY));
			if((screen.height-e.clientY)>600)
			{
				var x_pos=e.clientX;//e.clientX+document.body.scrollLeft;
				var y_pos=e.clientY;//e.clientY+document.body.scrollTop-20;
			}
			else
			{
				var x_pos=e.clientX;//'1000';
				var y_pos=e.clientY;//+document.body.scrollTop-320;
			}
		}
document.getElementById('image_div').style.left=x_pos-width+'px';
document.getElementById('image_div').style.top=y_pos-height+'px';
document.getElementById('image_div').style.visibility='visible';
document.getElementById('image_div').innerHTML="<img src='"+image_name+"' width="+width+" height="+height+" class=empty_border>";
}

function hide_image()
{
document.getElementById('image_div').style.visibility='hidden';
document.getElementById('image_div').innerHTML="";
}



function image_preview(file_name,width,height)
{
window.open("image_preview.php@file_name="+file_name+"&width="+width+"&height="+height,"img_preview","width="+width+",height="+height+",top=100,left=250,scrollbars=no,resizable=yes");
}


function video_preview(file_name)
{
window.open("video_preview.php@file_name="+file_name,"vid_preview","width=400,height=300,top=100,left=250,scrollbars=no,resizable=yes");
}

function delete_module_category(module,id)
{
	return_confirm=confirm("Are you sure that you want to delete this category?");
	if(return_confirm==true)
	window.location="module_configuration.php@module="+module+"&id="+id+"&delete_category=1";
}



function confirm_delete()
{
	return_confirm=confirm("Are you sure that you want to delete these data?");
	if(return_confirm==true)
	{
		frm.trash.value=1;
		frm.submit();
	}
}


function open_pdf_page(id,module)
{
window.open("pdf_page.php@id="+id+"&module="+module,"pdf","width=50,height=50,scrollbars=no,resizable=no");
}

function open_email_page(id,module)
{
window.open("send_email.php@id="+id+"&module="+module,"email","width=600,height=600,top=100,left=350,scrollbars=yes,resizable=yes");
}

function open_print_page(id,module)
{
window.open("print_page.php@id="+id+"&module="+module,"print","width=600,height=600,top=100,left=350,scrollbars=yes,resizable=yes");
}

function open_comments_page(id,module)
{
window.open("comments_page.php@id="+id+"&module="+module,"comments","width=600,height=600,top=100,left=350,scrollbars=yes,resizable=yes");
}

function data_preview(id,module)
{
window.open("data_preview.php@id="+id+"&module="+module,"preview","width=600,height=600,top=100,left=350,scrollbars=yes,resizable=yes");
}


function create_uploads(loop,file_txt)
{
if(loop<=0)
frm.upload_num.value=1;
else
frm.upload_num.value=loop;

if(loop>0)
{
i=0;
upload_contents="";
upload_contents=upload_contents+"<table width=85% border=0  cellpadding=2 cellspacing=2>";
for(i=0;i<loop;i++)
{
upload_contents=upload_contents+"<tr><td align=center><table width=100% border=0 cellpadding=0 cellspacing=0 align=center>";
upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+file_txt+" "+(i+1)+" :</td><td><input name=file_"+i+" type=file size=40></td></tr>";
upload_contents=upload_contents+"</table></td></tr>";
}
upload_contents=upload_contents+"</table>";
uploads.innerHTML=upload_contents;
}
}
function create_uploads_images(loop,file_txt)
{
if(loop<=0)
frm.upload_num_images.value=1;
else
frm.upload_num_images.value=loop;
if(loop>0)
{
i=0;
upload_contents="";
upload_contents=upload_contents+"<table width=85% border=0  cellpadding=2 cellspacing=2>";
for(i=0;i<loop;i++)
{
upload_contents=upload_contents+"<tr><td align=center><table width=100% border=0 cellpadding=0 cellspacing=0 align=center>";
upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+(i+1)+" :</td><td><input name=images_"+i+" type=file size=40></td></tr>";
/*upload_contents=upload_contents+"<tr><td width=25% class=normal_text>"+file_txt+" "+(i+1)+" :</td><td><input name=images_"+i+" type=file size=40></td></tr>";*/
upload_contents=upload_contents+"</table></td></tr>";
}
upload_contents=upload_contents+"</table>";
uploads_images.innerHTML=upload_contents;
}
}



function CreateControl(DivID, CLSID, ObjectID, WIDTH, HEIGHT, URL)
{
  var d = document.getElementById(DivID);
  contents="";
  contents=contents+"<object classid='"+CLSID+"' codebase='../../fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0/#version=8,0,0,0/default.htm' id='"+ObjectID+"' width='"+WIDTH+"' height='"+HEIGHT+"'>";
  contents=contents+"<param name='allowScriptAccess' value='sameDomain' />";
  contents=contents+"<param name='movie' value='"+URL+"' />";
  contents=contents+"<param name='loop' value='false' />";
  contents=contents+"<param name='menu' value='false' />";
  contents=contents+"<param name='quality' value='high' />";
  contents=contents+"<param name='wmode' value='transparent' />";
  contents=contents+"<param name='bgcolor' value='#ffffff' />";
  contents=contents+"<embed src='"+URL+"' loop='false' menu='false' quality='high' wmode='transparent' bgcolor='#ffffff'  width='"+WIDTH+"' height='"+HEIGHT+"' name='"+ObjectID+"' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='../../www.macromedia.com/go/getflashplayer' />";
  contents=contents+"</object>";
      
  d.innerHTML =contents;
}



function open_calendar_window(target)
{
window.open("../../fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0/calendar_popup.php?module=calendar&target="+target,"calendar","width=175,height=160,top=200,left=560,scrollbars=no");
}

function get_date(target,date)
{
split_date="";
split_date=date.split("-");
document.getElementById(target).value=split_date[1]+"-"+split_date[2]+"-"+split_date[0];
}


function create_book_index(loop,order_txt,title_txt,index_id,order_data,index_data)
{
if(loop<=0)
frm.index_num.value=1;
else
frm.index_num.value=loop;

split_index_id=index_id.split("_");
split_index_order=order_data.split("_");
split_index_data=index_data.split("_");
if(loop>0)
{
i=0;
index_contents="";
index_contents=index_contents+"<table width=85% border=0  cellpadding=2 cellspacing=2>";
for(i=0;i<loop;i++)
{

if(split_index_id[i]!="" && split_index_id[i]!=null)
data_id=parseInt(split_index_id[i]);
else
data_id=i+1;

if(split_index_order[i]!="" && split_index_order[i]!=null)
data_order=parseInt(split_index_order[i]);
else
data_order=i+1;

if(split_index_data[i]!="" && split_index_data[i]!=null)
data_index=split_index_data[i];
else
data_index='';

index_contents=index_contents+"<tr><td align=center><table width=100% border=0 cellpadding=0 cellspacing=0 align=center>";
index_contents=index_contents+"<tr><td width=25% class=normal_text>"+order_txt+":</td><td><input name=index_id_"+i+" type=hidden value='"+data_id+"'><input name=index_order_"+i+" type=text size=5 value='"+data_order+"'></td><td class=normal_text>&nbsp;&nbsp;&nbsp;"+title_txt+"&nbsp;&nbsp;&nbsp;<input name=index_title_"+i+" type=text size=50 value='"+data_index+"'></td></tr>";
index_contents=index_contents+"</table></td></tr>";
}
index_contents=index_contents+"</table>";
book_index_data.innerHTML=index_contents;
}
}

function openPage(pagename)
{
	window.location=pagename;
}
