function startMap(x) {
	if (x == 's') {
		w = 790 ;
		h  = 400 ;
	}else{
		x = 'm' ;
		w = 990 ;
		h = 490 ;
	}
	if (screen.height > h && screen.width> w) {
		t = (screen.height -h) / 2 ;
		l =(screen.width -w ) / 2 ;
	}else{
		t = 0 ;
		l = 0 ;
	}
	window.open (baseHref+'map.php?r='+x, 'map' , 'width='+w+',height='+h+',toolbar=no,status=no,left='+l+',top='+t+',screenX='+l+',screenY='+t ) ;	
}


function cl_charCount(){
	try {
		var rem_count = classifieds_description_length - document.getElementById('description').value.length ;
		if (rem_count < 0 ) {
			document.getElementById('description').value  = document.getElementById('description').value.substr(0,classifieds_description_length ) ;
			rem_count = 0 ;
		}
		document.getElementById('cl_char_count').innerHTML = rem_count + ' of ' +  classifieds_description_length + ' ramaining'; 
	}catch (e){}
}
function cl_testCount(){
	try {
		var rem_count = classifieds_description_length - document.getElementById('description').value.length ;
		if (rem_count < 0 ) {
			document.getElementById('description').value  = document.getElementById('description').value.substr(0,classifieds_description_length -1 ) ;
			cl_charCount() ;
			return false ;
		}
		return true ;
	}catch (e){}
}
function expandMenuItem(item){
	var i = document.getElementById(item);
	var p = i.parentNode ;
	if (i.style.display != 'block' ){
		i.previousSibling.className = 'collapse' ;		
		i.style.display = 'block' ;
	}else{
		i.style.display = 'none' ;
		i.previousSibling.className = 'expand' ;		
	}
}

function popPage(page){
	var properties = new Array (
		['location','no'],
		['menubar','no'],
		['resizable','no'],
		['scrollbars','yes'],
		['status','no'],
		['toolbar','no'],
		['width','500'],
		['height','400']
	);
	var useprops = '';
	var customarguments = new Array();	
	var p_width = 0;
	var p_height = 0 ;
	if (arguments[1]) {
		customarguments = arguments[1].split(',') ;
	}
	for (var i = 0  ; i < properties.length ; i ++ ) {
		var propset = false ;		
		for (var j = 0 ; j < customarguments.length ; j+=2) {
			if (customarguments[j] == properties[i][0]) {
				useprops += properties[i][0] +'=' + customarguments[j+1] ;
				if (properties[i][0] == 'width' ) {
					p_width = customarguments[j+1] ;
				}
				if (properties[i][0] == 'height' ) {
					p_height = customarguments[j+1] ;
				}
				propset = true ;		
			}	
		}
		if (!propset) {
			useprops += properties[i][0] +'=' + properties[i][1]
			if (properties[i][0] == 'width' ) {
				p_width = properties[i][1] ;
			}
			if (properties[i][0] == 'height' ) {
				p_height = properties[i][1] ;
			}
		}
		useprops += ','
	}
	if (page) {
		useprops += 'left=' + parseInt((screen.width - parseInt(p_width))/2) + ',top=' + parseInt((screen.height - parseInt(p_height))/2) ;
		window.open (baseHref + 'popup.php?page=' + page , 'popup' , useprops);
	}
}


new Array(['width',100], ['height',50], ['status','no'])
