var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=getFFVersion>=0.1? 16 : 0 


function dyniframesize(iframename) {	
	try{
	  var pTar = null;
	  if (document.getElementById){
		pTar = document.getElementById(iframename);
	  }
	  else{
		eval('pTar = ' + iframename + ';');
	  }
	  if (pTar && !window.opera){
		//begin resizing iframe
		pTar.style.display="block"
		
		if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
		  //ns6 syntax
		  pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight; 		  
		}
		else if (pTar.Document && pTar.Document.body.scrollHeight){
		  //ie5+ syntax
		  pTar.height = pTar.Document.body.scrollHeight;		 
		}
		else
		{
			pTar.height = 200;	
		}
		if(pTar.height < 200)
			pTar.height = 200;
		
	  }  
	  
	}catch(ex){}
}
  
function UrlExists(url)   
{   
	var xmlhttp= getXMLHttp();	
	xmlhttp.open("HEAD",url,false);   
	xmlhttp.send();   	
	return xmlhttp.status=="404"?false:true
}

function getXMLHttp(){
	var HttpRequest = false;	
		if(window.XMLHttpRequest){ // Mozilla, Safari,...
			HttpRequest = new XMLHttpRequest();
			if(HttpRequest.overrideMimeType){
				HttpRequest.overrideMimeType('text/xml');
			}
		}else if(window.ActiveXObject){ // IE
			try{
				HttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e){
				try{
					HttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
				}catch(e){
					try{
						HttpRequest = new ActiveXObject("Msxml2.XMLHTTP.5.0");
					}catch(e){
						try{
							HttpRequest = new ActiveXObject("Msxml2.XMLHTTP.4.0");
						}catch(e){
							try{
								HttpRequest = new ActiveXObject("Msxml2.XMLHTTP.3.0");
							}catch(e){}
						}
					}
				}
			}
		}	
		return HttpRequest;
}

function ChangeFrameSrc(url){
	try{
	   if(!UrlExists(url)){
		   url = "PayPoints.aspx";
	   }
	   url = url.replace(/\%2f/g,"/");	   
		document.MainContentFrame.location = url;
	}catch(ex){}
}	
