function checkRemeber(){
	if(document.login.remember.checked) {
		document.login.remember.checked = false;
	}else{
		document.login.remember.checked = true;
	}
	
}

var addUnl = new Array();
function addUnlimited(slot, startNum, stopNum){
	var num = parseInt(addUnl['unlimitedCount_' + slot]);
	var newnum = num + 1;
	var IdStr = slot + '_' + slot + '_' + startNum; 
	var newIdStr = slot + '_' + slot + '_' + newnum; 

	var slotDiv = 'moreupload_' + slot;
	slotDivObj = document.getElementById(slotDiv);
	slotDivCont = slotDivObj.innerHTML;

	var moreDivObj = document.getElementById('moreContainer_' + slot);
	var moreDivCont = moreDivObj.innerHTML;

	newContents = slotDivCont.replace(IdStr, newIdStr);
	newContents = newContents.replace(IdStr, newIdStr);

	if((stopNum == 0) || (newnum < stopNum)) {
		moreDivObj.innerHTML = moreDivCont + newContents;
		addUnl['unlimitedCount_' + slot] = newnum;
	}else{
		alert('<?= translate_text("Sorry! You are not allowed to upload more files for this slot.", $_GET[lang_id]); ?>');
	}
}

function resetContainer(slot, startNum){
	var id = 'moreContainer_' + slot;
	addUnl['unlimitedCount_' + slot] = startNum;
	var containerObj = document.getElementById(id);
	containerObj.innerHTML = '';
	
}

var dt = new Date();

function AjaxInit() {
	var xmlhttp=false;
	if(window.XMLHttpRequest){
	 xmlhttp = new XMLHttpRequest();
	} else if (window.ActiveXObject){
	 	xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
	 if (!xmlhttp){
	 	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	 }
	} 
	return(xmlhttp);
}



function ADAjaxPostData(url, queryStr, loadingDiv){
	divObj = document.getElementById(loadingDiv);
	if(divObj) {
		window.status = "Loading...";
		divObj.innerHTML = "<span class='statusWait'>Loading...</span>";
	}
	var Ajax=AjaxInit();
	try {	
		Ajax.open('POST', url);
		Ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
		Ajax.onreadystatechange = function() {
			if (Ajax.readyState == 4 && Ajax.status == 200) {
				
				divObj.innerHTML = Ajax.responseText;
				window.status = "Done";
			}
		}
		Ajax.send(queryStr + "&random=" + Math.random());	
	}catch (errv) {
		Ajax.send(errv);
	}				
}

function Showsubdropdown(aid, divi) {
	ADAjaxPostData('../../forums/admin/subcat_db.php', 'aid=' + aid, divi);
		
}
function Showstatedropdown(aid, divi, state_id) {
	ADAjaxPostData('../../users/admin/subcat_db.php', 'aid=' + aid + '&state_id=' + state_id, divi);
		
}
function Showfrontstatedropdown(aid, divi, state_id) {
	//alert("I am here to show states dropdown");
	ADAjaxPostData('../users/subcat_db.php', 'aid=' + aid + '&state_id=' + state_id, divi);
		
}

function Showsubclass(aid, divi) {
	ADAjaxPostData('../classified/class_sub.php', 'aid=' + aid, divi);
		
}


function Showsubclassdropdown(aid, divi) {
	ADAjaxPostData('../../classified/admin/subcat_db.php', 'aid=' + aid, divi);
}



function showBG(trID){
		obj = document.getElementById(trID);
		obj.bgColor="#b0DAF0";
	}
	
	function hideBG(trID){
		obj = document.getElementById(trID);
		obj.bgColor="#E0F1FF";
	}
	
function leftShowBG(trID){
	obj = document.getElementById(trID);
	obj.bgColor="#4fa7e0";
}	

function leftHideBG(trID,val){
	obj = document.getElementById(trID);
	if(val!=1){
		obj.bgColor="#def0fa";
	}else{
		obj.bgColor="#FFFFFF";
	}
}



function mailpage(){
	mail_str = "mailto:?subject=Check out the " + document.title;
	mail_str += "&body=I thought you might be interested in the " + document.title;
	mail_str += ". You can view it at, " + location.href;
	location.href = mail_str;
}

function bookmark(){
bookmarkurl=location.href
bookmarktitle=document.title
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
else if (window.sidebar) // firefox
window.sidebar.addPanel(bookmarktitle, bookmarkurl, "");
}

