function loadXMLDoc(url)
{
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
		document.getElementById("rezadiv").innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.overrideMimeType("text/plain");
	xmlhttp.open("GET",url,true);
	//xmlhttp.setRequestHeader("Content-type","text/plain");
	xmlhttp.send(null);
	alert(url);
}

function ajaxFunction(url)
{
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('rezadiv');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			
			var iframeDoc = window.frames.main.document;
			iframeDoc.body.appendChild(ajaxRequest.responseText);
			
		}
	}

	ajaxRequest.overrideMimeType("text/plain");
	ajaxRequest.open("GET", url, true);
	ajaxRequest.send(null); 
	
	alert(url);
}


function reload_frame(url)
{
	iframe = document.getElementById('myframe');
	iframe.src = url;//'1.htm';
	//alert(url);
	//return false;
	if(navigator.userAgent.indexOf("Firefox")>0)
	{
		setTimeout("location.reload(true);",1000);
	}
}


function autoIframe(frameId){
	try{
		frame = document.getElementById(frameId);
		innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
		objToResize = (frame.style) ? frame.style : frame;
		objToResize.height = innerDoc.body.scrollHeight + 10;
	}
	catch(err){
		window.status = err.message;
		//alert(err.message);
	}
}

function doIframet(){
	o = document.getElementsByTagName('iframe');
	for(i=0;i<o.length;i++){
		if (/\bautoHeight\b/.test(o[i].className)){
			setHeightt(o[i]);
			addEventt(o[i],'load', doIframet);
		}
	}
}

function setHeightt(e){
	if(e.contentDocument){
		try
		{
			e.height = e.contentDocument.body.offsetHeight + 50;
		}catch(q)
		{
			e.height = 1500;
		}
	} else {
		try{
		e.height = e.contentWindow.document.body.scrollHeight;
		}catch(e){}
	}
	//autoIframe("myframe");
}

function addEventt(obj, evType, fn){
	if(obj.addEventListener)
	{
	obj.addEventListener(evType, fn,false);
	return true;
	} else if (obj.attachEvent){
	var r = obj.attachEvent("on"+evType, fn);
	return r;
	} else {
	return false;
	}
}


if (document.getElementById && document.createTextNode){
 addEventt(window,'load', doIframet);	
}
/*
function resizeToContent()
{
	var x =0;
	var docHeight;
	if (typeof document.height != 'undefined') 
	{
		docHeight = document.height;
	}
	else if (document.compatMode && document.compatMode != 'BackCompat') 
	{
		docHeight = document.documentElement.scrollHeight;
	}
	else if (document.body && typeof document.body.scrollHeight !='undefined') 
	{
		docHeight = document.body.scrollHeight;
	}
	var y = docHeight;

	while (x < y){
	x+=1;
	}
	//document.getElementById("myframe").style.height=x
	var iframeids=["myframe"];
	var iframehide="yes";

	var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];
	var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 ;//extra height in px to add to iframe in FireFox 1.0+ browsers

	for (i=0; i<iframeids.length; i++)
	{
		if ((document.all || document.getElementById) && iframehide=="no")
		{
			var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
			tempobj.style.height=x;
		}
	}
}*/


function resizeIframe(oIframe)
{
	if(oIframe.contentDocument)
	{
		var innerHeight = oIframe.contentDocument.body.offsetHeight ;
	} else 
	{
		try
		{
			var innerHeight = oIframe.contentWindow.document.body.scrollHeight;
		}catch(e){}
	}
	//var innerHeight = oIframe.contentWindow.getActualHeight();
	oIframe.height = innerHeight;
}
var c=0;
var t;
var timer_is_on=0;

function timedCount()
{
var tmp=document.all? document.all["myframe"] : document.getElementById("myframe")
//resizeIframe(tmp);
autoIframe("myframe");

c=c+1;
t=setTimeout("timedCount()",2000);
}

function doTimer()
{
if (!timer_is_on)
  {
  timer_is_on=1;
  //timedCount();
  setTimeout("timedCount()",1000);
  }
}
//doTimer();


