function _pop(scroll, url, width, height, name) {
	if (typeof(width) == "undefined") { width=screen.width; }
	if (typeof(height) == "undefined") { height=screen.height; }
	if (name!=true) { var rnd = (Math.round((Math.random()*999)+1)); }
	else { var rnd="x"; }
	var top=Math.floor((screen.availHeight-height)/2)-(screen.height-screen.availHeight);
	var left=Math.floor((screen.availWidth-width)/2)-(screen.width-screen.availWidth);
	window.open(url, "w"+rnd, "top="+top+", left="+left+", width="+width+", height="+height+", buttons=no, scrollbars="+(scroll?"yes":"no")+", location=no, menubar=no, resizable="+(scroll?"yes":"no")+", status=no, directories=no, toolbar=no");
}

function _popup(url, width, height,name) {
	_pop(false, url, width, height, name);
    void(0);
}

function _popupR(url, width, height,name) {
	_pop(true, url, width, height, name);
    void(0);
}

function bindEvent(object, event, func) {
    if(object.attachEvent) {
		object.attachEvent('on'+event, func);
	} else {
		if(object.addEventListener) {
			object.addEventListener(event, func, false);
		} else {
		}
	}
}

function unBindEvent(object, event, func) {
    if(object.attachEvent) {
		object.dettachEvent('on'+event, func);
    } else {
		if(object.addEventListener) {
			object.removeEventListener(event, func, false);
		} else {
		}
	}
}

/*function resolution() {
	var theWidth, theHeight, minHeight;
	
	minHeight= document.documentElement.clientHeight - 448;
			
	document.getElementById('content').style.min-height = minHeight+"px";
	
}*/

function getElementHeight() {
	var a;
	a = document.getElementById('container').clientHeight;
	document.getElementById('footer-container').style.top = a+"px";
} 

function ShowPopup(hoveritem,id)
	{	
		
		var curleft = curtop = 0;
		if (hoveritem.offsetParent) {
			curleft = hoveritem.offsetLeft
			curtop = hoveritem.offsetTop
			while (hoveritem = hoveritem.offsetParent) {
				curleft += hoveritem.offsetLeft
				curtop += hoveritem.offsetTop
			}
		}

		hp = document.getElementById(id);
		
		// Set position of hover-over popup
		
			
			hp.style.top = curtop + 60+"px";
		
			hp.style.left = curleft + 90+"px";

			
			
		// Set popup to visible
		hp.style.visibility = "visible";
		
	}
	
	function HidePopup(id)
	{
		hp = document.getElementById(id);
		hp.style.visibility = "hidden";
	}
	

var xmlhttp=false;

if (window.XMLHttpRequest){
          // If IE7, Mozilla, Safari, etc: Use native object
          var xmlhttp = new XMLHttpRequest()
}
else
{
if (window.ActiveXObject){
          // ...otherwise, use the ActiveX control for IE5.x and IE6
          var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          }
}

function ajax_call(urlas) {
	document.getElementById('streets').options.length = 1;
	var selId = document.getElementById('cities').selectedIndex;
	xmlhttp.open("POST", urlas+"?cid="+selId , true);
	
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {		
			var streets = xmlhttp.responseText;
			
			var str = streets.split("#");
			for (i=0;i<str.length-1;i=i+1)
			{
				document.getElementById('streets').options[document.getElementById('streets').options.length] = new Option(str[i], str[i])
			}			
		}
	}
		
	xmlhttp.send(null)
	return false;

	//var cid = document.search.cities.selectedIndex;
	//xmlhttp.open("GET", urlas , true);
	
	//xmlhttp.send(null)
	//return false;
}

function changePic(pic) {
	var elem = document.getElementById('photo');
	elem.style.background = '#626262 url(/page/upload/'+pic+') no-repeat left center';
}

function selected(id, count) {
	for(i=1;i<=count;i++){
		document.getElementById('li'+i).style.background = 'none';
	}
	var elem = document.getElementById('li'+id);
	elem.style.background = '#ff7800';
}

function selectedVi(id, count) {
	for(i=1;i<=count;i++){
		document.getElementById('liVi'+i).style.background = 'none';
	}
	var elem = document.getElementById('liVi'+id);
	elem.style.background = '#ff7800';
}

function soundOff() {
	parent.soundFrame.location.href="/nosound.html";
	document.getElementById('sndon').style.display="none";
	document.getElementById('sndoff').style.display="block";
	return false;
}

function soundOn() {
	parent.soundFrame.location.href="/sound.html";
	document.getElementById('sndon').style.display="block";
	document.getElementById('sndoff').style.display="none";
	return false;
}

