/***********************************************
* Ajax Tabs Content script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/


var bustcachevar=1//bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://ucomparehealthcare.com/"
var loadstatustext="<img src='/img/loading.gif' />";




function log(text) {
  var log = document.getElementById('uchc_log');
  if(!log) {
    log = document.createElement('div');
    log.id = 'uchc_log';
    log.style.width = '500px';
    log.style.height = '300px';
    log.style.position = 'absolute';
    log.style.top = '5px';
    log.style.left = '5px';
    log.style.background = 'white';
    document.getElementsByTagName('body')[0].appendChild(log);
  }
  log.innerHTML += text + '<br/>';
}

function ajaxpage(url, containerid){	
	var page_request = false
	if (window.XMLHttpRequest)
		page_request = new XMLHttpRequest()
	else if (window.ActiveXObject){ // if IE
		try { page_request = new ActiveXObject("Msxml2.XMLHTTP") } 
		catch (e){try{page_request = new ActiveXObject("Microsoft.XMLHTTP")}catch (e){}}
	}else return false

	document.getElementById(containerid).innerHTML=loadstatustext;
	
	page_request.onreadystatechange=function(){loadpage(page_request, containerid)}
	page_request.open('GET', url, true)
	page_request.send(null)
}

function loadpage(page_request, containerid){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
		document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
	if (!document.getElementById)
		return
	for (i=0; i<arguments.length; i++){
		var file=arguments[i]
		var fileref=""
		if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
			if (file.indexOf(".js")!=-1){ //If object is a js file
				fileref=document.createElement('script')
				fileref.setAttribute("type","text/javascript");
				fileref.setAttribute("src", file);
			}else if (file.indexOf(".css")!=-1){ //If object is a css file
				fileref=document.createElement("link")
				fileref.setAttribute("rel", "stylesheet");
				fileref.setAttribute("type", "text/css");
				fileref.setAttribute("href", file);
			}
		}
		if (fileref!=""){
			document.getElementsByTagName("head").item(0).appendChild(fileref)
			loadedobjects+=file+" " //Remember this object as being already added to page
		}
	}
}

function go_town(id, url)
{
	value = document.getElementById('drs_state').value;
	url+=value;	
	ajaxpage(url, id);
}

function go_index(id, url)
{
	value = document.getElementById('site_pull').value;
	if(value==1){
		window.location="/";
	}
	if(value==3){
		window.location="/physicians_start.html";
	}	
	if(value==4){
		window.location="/hospital_start.html";
	}	
	if(value==5){
		window.location="/nursinghome_start.html";
	}	
	if(value==6){
		window.location="/assistant.html";
	}	
	if(value==7){
		window.location="/providers/";
	}	
	if(value==8){
		window.location="/companies_info.html";
	}	
	if(value==9){
		window.location="/about_us/";
	}	
	if(value==10){
		window.location="/sitemap.html";
	}
	if(value==11){
		window.location="/mammography_start.html";
	}	

	
}

function checkAgreement()
{
	if (!document.form.agreeTerms.checked) {
		alert("You have to agree to the User Agreement to continue.") ;
		exit;
	}else{
		document.form.submit();
		//alert("good to go.");		
	}
}

function AddDeleteField(what) {
	val = document.getElementById(what);
    if (val.value == 0)
        val.value =1;
    else
        val.value =0;
}

function showhide(divid){
	if(document.getElementById(divid).style.display == 'none'){
	  document.getElementById(divid).style.display = 'block';
	}else{
	  document.getElementById(divid).style.display = 'none';
	}
}
