/*
	copyright WebGK 2008
*/
<?
function get_path($self) {
		if (isset($GLOBALS["HTTP_HOST"]))
			$temp=$GLOBALS["HTTP_HOST"];
		else
			$temp=$_SERVER["HTTP_HOST"];
		return str_replace($self, "", "http://".$temp.$_SERVER["PHP_SELF"]);
}
function buf($buf)
	{return preg_replace("~\s+~"," ", $buf); }
	//ob_start("buf");

?>
function pishitepisma(whe, who) {window.open('mailto:'+who+'@'+whe, '_top')}

function processStateChange(){
  if (request.readyState == 4){
	contentDiv = document.getElementById(dest);
	if (request.status == 200){
		response = request.responseText;
		contentDiv.innerHTML = response;				
	} else {
		contentDiv.innerHTML = "Error: "+request.status;
	}
  }
}		
var request;
var dest;
function loadHTML(URL, destination){
	dest = destination;
	if(window.XMLHttpRequest){
		request = new XMLHttpRequest();
		request.onreadystatechange = processStateChange;
		request.open("GET", URL, true);
		request.send(null);
	}
	else{
		if (window.ActiveXObject) {
			request = new ActiveXObject("Microsoft.XMLHTTP");
			if (!request) request = new ActiveXObject("MSxml2.XMLHTTP");
			if (request) {
				request.onreadystatechange = processStateChange;
				request.open("GET", URL, true);
				request.send();
			}
		}
	}
}

function show(name,id) {
	var x,y;
	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight;
	if (test1 > test2) {
		x = document.body.scrollWidth;
		y = document.body.scrollHeight;
	}
	else {
		x = document.body.offsetWidth;
		y = document.body.offsetHeight;
	}
	if(navigator.appName != "Microsoft Internet Explorer"){
		document.getElementById(name+id).style.height=y-document.body.scrollTop;
		document.getElementById(name+id).style.padding=document.body.scrollTop+"px 0px 0px 0px";
		document.getElementById(name+id).style.width='100%';
		
		document.getElementById(name+"_"+id).style.width='100%';
		document.getElementById(name+"_"+id).style.height=y;
	}
	else{
		document.getElementById(name+id).style.height=y;
		document.getElementById(name+id).style.padding=document.body.scrollTop+20+"px 0px 0px 0px";
		document.getElementById(name+id).style.width=x;
		
		document.getElementById(name+"_"+id).style.height=y;
		document.getElementById(name+"_"+id).style.width=x;
	}
	<?$BASE = get_path("script.js");?>
	loadHTML('<?=$BASE?>photo.php?photo='+id+'&name='+name,name+id);
	document.getElementById(name+id).style.display='block';	
	document.getElementById(name+"_"+id).style.display='block';		
}
function load(i2,id,t,cont){
	loadHTML('<?=get_path("script.js")?>newcont.php?type='+i2+'&id='+id+'&screenw='+screen.width+'&page='+t,cont);
	var p = document.getElementsByTagName ("DIV");
			for (i=0; i<p.length; ++i)
				if (p[i].className == "newcont")
					p[i].style.display="none";
	document.getElementById(cont).style.display = "block";
	var g = document.getElementsByTagName ("A");
			for (i=0; i<g.length; ++i)if (g[i].className == "m"){
				g[i].style.color="#333333";
				g[i].style.fontWeight = "normal";
				g[i].style.background = "url(img/s1.png) no-repeat right";
			}
	document.getElementById("m"+i2).style.color = "#CC6666";
	document.getElementById("m"+i2).style.fontWeight = "bold";
	document.getElementById("m"+i2).style.background = "url(img/s2.png) no-repeat right";
}

function rol_on(id){
	document.getElementById("logo"+id).src ='img/usr/logoon'+id;
	document.getElementById("obj"+id).className="text_product_s";
}

function rol_off(id){
	document.getElementById("logo"+id).src ='img/usr/logooff'+id;
	document.getElementById("obj"+id).className="text_product";

}
