// JavaScript Document

//pentru marirea unui iframe
function adjustIFrameSize(iframeWindow) 
{
	//try
	//{
		if (iframeWindow.document.height) 
		{
			var iframeElement = document.getElementById(iframeWindow.name);
			iframeElement.style.height = iframeWindow.document.height + 'px';
		}
		else if (document.all) 
		{
			var iframeElement = document.all[iframeWindow.name];
			if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') 
				iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight ;
			else 
				iframeElement.style.height = iframeWindow.document.body.scrollHeight;
		}
	//}catch(exception){}
}


function doConfirm(question, answer)
{
	if(answer.length > 0) return (prompt(question+' If yes, write ['+answer+'] in the below box and press OK.', '') == answer);
	else return confirm(question);
}

function toggle(id)
{
    var el = getObject(id);
	if (el.style.display == 'none') {
		el.style.display = 'block'
	} else {
		el.style.display = 'none'
	}
}

function showOrHide(id, show)
{
	var el = getObject(id);
	el.style.display = show?'block':'none';
}

function getObject(name) {
   var ns4 = (document.layers) ? true : false;
   var w3c = (document.getElementById) ? true : false;
   var ie4 = (document.all) ? true : false;

   if (ns4) return eval('document.' + name);
   if (w3c) return document.getElementById(name);
   if (ie4) return eval('document.all.' + name);
   return false;
}

function preloadImages(images){
	var preloadedImages = new Array();
	for(i = 0; i < images.length; i++){
		preloadedImages[i] = new Image();
		preloadedImages[i].src = images[i];
	}
}

function GetxmlHttp() {
	var xmlHttp;
	try {
    	// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)  {
		// Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	        }
			catch (e){
				xmlHttp=false;
			}
		}
	}
	return xmlHttp;
}

