   var http_request = false;
   var http_request_two = false;
   var http_request_three = false;
   function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }     
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }
	
	function makePOSTRequestTwo(url, parameters) {
      http_request_two = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request_two = new XMLHttpRequest();
         if (http_request_two.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request_two.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request_two = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request_two = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request_two) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      http_request_two.onreadystatechange = alertContents2;
      http_request_two.open('POST', url, true);
      http_request_two.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request_two.setRequestHeader("Content-length", parameters.length);
      http_request_two.setRequestHeader("Connection", "close");
      http_request_two.send(parameters);
   }

   	function makePOSTRequesThree(url, parameters) {
      http_request_three = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request_three = new XMLHttpRequest();
         if (http_request_three.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request_three.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request_three = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request_three = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request_three) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      http_request_three.onreadystatechange = alertContents2;
      http_request_three.open('POST', url, true);
      http_request_three.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request_three.setRequestHeader("Content-length", parameters.length);
      http_request_three.setRequestHeader("Connection", "close");
      http_request_three.send(parameters);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('loginbox').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
   function alertContents2() {
      if (http_request_two.readyState == 4) {
         if (http_request_two.status == 200) {
            //alert(http_request.responseText);
            result = http_request_two.responseText;
            document.getElementById('commentformbox').innerHTML = result;            
         } else {
            alert('There was a problem with the request.  Try Again.');
         }
      }
   }
   
   function alertContents3() {
      if (http_request_three.readyState == 4) {
         if (http_request_three.status == 200) {
            //alert(http_request.responseText);
            result = http_request_three.responseText;
            document.getElementById('ratingformbox').innerHTML = result;            
         } else {
            alert('There was a problem with the request.  Try Again.');
         }
      }
   }

   function getlogindetails(obj) {
      var poststr = "username=" + encodeURI( document.getElementById("username").value ) +
                    "&password=" + encodeURI( document.getElementById("password").value );
      makePOSTRequest('/loginrequest.cfm', poststr);
   }
   
   function submitcomment(obj) {
      var poststr = "articleid=" + encodeURI( document.getElementById("articleid").value ) +
                    "&commentcontent=" + encodeURI( document.getElementById("commentcontent").value );
      makePOSTRequestTwo('/commentrequest.cfm', poststr);
	  document.getElementById('nocomments').innerHTML="";
   }
   
   function submitrating(obj) {
      var poststr = "id=" + encodeURI( document.getElementById("articleidforrating").value ) +
                    "&ratingvalue=" + encodeURI( document.getElementById("ratingvalue").value );
      makePOSTRequestThree('/ratingrequest.cfm', poststr);
   }
   
var xmlHttp   
var xmlHttpTwo   
var xmlHttpThree   



function showlogin() { 
	// document.getElementById(position).innerHTML="Please Wait";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/loginrequest.cfm?sid=" + Math.random();
	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttp.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttp)	{
			xmlHttp.send()
		}
	}
	function stateChanged() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
			document.getElementById('loginbox').innerHTML=xmlHttp.responseText 
		} 
	} 
}
function showcommentlink(articleid) { 
	// document.getElementById(position).innerHTML="Please Wait";
	xmlHttpTwo=GetXmlHttpObjectTwo()
	if (xmlHttpTwo==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/commentrequest.cfm?id=" + articleid + "&sid=" + Math.random();
	xmlHttpTwo.onreadystatechange=stateChangedTwo
	xmlHttpTwo.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttpTwo.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttpTwo)	{
			xmlHttpTwo.send()
		}
	}
	function stateChangedTwo() { 
		if (xmlHttpTwo.readyState==4 || xmlHttpTwo.readyState=="complete") { 
			document.getElementById('commentformbox').innerHTML=xmlHttpTwo.responseText 
		} 
	} 
}

function showratinglink(articleid) { 
	// document.getElementById(position).innerHTML="Please Wait";
	xmlHttpThree=GetXmlHttpObjectThree()
	if (xmlHttpThree==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/ratingrequest.cfm?id=" + articleid + "&sid=" + Math.random();
	xmlHttpThree.onreadystatechange=stateChangedThree
	xmlHttpThree.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttpThree.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttpThree)	{
			xmlHttpThree.send()
		}
	}
	function stateChangedThree() { 
		if (xmlHttpThree.readyState==4 || xmlHttpThree.readyState=="complete") { 
			document.getElementById('ratingformbox').innerHTML=xmlHttpThree.responseText 
		} 
	} 
}

function showfavorite(articleid) { 
	xmlHttpFour=GetXmlHttpObjectFour()
	if (xmlHttpFour==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/favoriterequest.cfm?id=" + articleid + "&sid=" + Math.random();
	xmlHttpFour.onreadystatechange=stateChangedFour
	xmlHttpFour.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttpFour.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttpFour)	{
			xmlHttpFour.send()
		}
	}
	function stateChangedFour() { 
		if (xmlHttpFour.readyState==4 || xmlHttpFour.readyState=="complete") { 
			document.getElementById('favoritebox').innerHTML=xmlHttpFour.responseText 
		} 
	}
}

function reorderfavorites(neworder) { 
	xmlHttpFour=GetXmlHttpObjectFour()
	if (xmlHttpFour==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/favoriteorderrequest.cfm?neworder=" + neworder + "&sid=" + Math.random();
	xmlHttpFour.onreadystatechange=stateChangedFour
	xmlHttpFour.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttpFour.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttpFour)	{
			xmlHttpFour.send()
		}
	}
	function stateChangedFour() { 
		if (xmlHttpFour.readyState==4 || xmlHttpFour.readyState=="complete") { 
			document.getElementById('favoritestatus').innerHTML=xmlHttpFour.responseText 
		} 
	}
}

function makefavorite(articleid) { 
	xmlHttpFour=GetXmlHttpObjectFour()
	if (xmlHttpFour==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/favoriterequest.cfm?id=" + articleid + "&makefavorite=yes&sid=" + Math.random();
	xmlHttpFour.onreadystatechange=stateChangedFour
	xmlHttpFour.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttpFour.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttpFour)	{
			xmlHttpFour.send()
		}
	}
	function stateChangedFour() { 
		if (xmlHttpFour.readyState==4 || xmlHttpFour.readyState=="complete") { 
			document.getElementById('favoritebox').innerHTML=xmlHttpFour.responseText 
		} 
	}
}

function removefavorite(articleid) { 
	xmlHttpFour=GetXmlHttpObjectFour()
	if (xmlHttpFour==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/favoriterequest.cfm?id=" + articleid + "&removefavorite=yes&sid=" + Math.random();
	xmlHttpFour.onreadystatechange=stateChangedFour
	xmlHttpFour.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttpFour.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttpFour)	{
			xmlHttpFour.send()
		}
	}
	function stateChangedFour() { 
		if (xmlHttpFour.readyState==4 || xmlHttpFour.readyState=="complete") { 
			document.getElementById('favoritebox').innerHTML=xmlHttpFour.responseText 
		} 
	}
}
function removefavorite_profile(articleid,location) { 
	xmlHttpFour=GetXmlHttpObjectFour()
	if (xmlHttpFour==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/favoriterequest.cfm?id=" + articleid + "&location=" + location + "&removefavoriteprofile=yes&sid=" + Math.random();
	xmlHttpFour.onreadystatechange=stateChangedFour
	xmlHttpFour.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttpFour.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttpFour)	{
			xmlHttpFour.send()
		}
	}
	function stateChangedFour() { 
		if (xmlHttpFour.readyState==4 || xmlHttpFour.readyState=="complete") { 
			document.getElementById(location).style.display='none';
		} 
	}
}


function openform() { 
	// document.getElementById(position).innerHTML="Please Wait";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/loginrequest.cfm?openform&sid=" + Math.random();
	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttp.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttp)	{
			xmlHttp.send()
		}
	}
	function stateChanged() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
			document.getElementById('loginbox').innerHTML=xmlHttp.responseText 
		} 
	} 
}

function opencommentform(articleid) { 
	// document.getElementById(position).innerHTML="Please Wait";
	xmlHttpTwo=GetXmlHttpObjectTwo()
	if (xmlHttpTwo==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/commentrequest.cfm?opencommentform&id=" + articleid + "&sid=" + Math.random();
	xmlHttpTwo.onreadystatechange=stateChangedTwo
	xmlHttpTwo.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttpTwo.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttpTwo)	{
			xmlHttpTwo.send()
		}
	}
	function stateChangedTwo() { 
		if (xmlHttpTwo.readyState==4 || xmlHttpTwo.readyState=="complete") { 
			document.getElementById('commentformbox').innerHTML=xmlHttpTwo.responseText 
		} 
	} 
}

function openratingform(articleid) { 
	// document.getElementById(position).innerHTML="Please Wait";
	xmlHttpThree=GetXmlHttpObjectTwo()
	if (xmlHttpThree==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/commentrequest.cfm?id=" + articleid + "&sid=" + Math.random();
	xmlHttpThree.onreadystatechange=stateChangedThree
	xmlHttpThree.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttpThree.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttpThree)	{
			xmlHttpThree.send()
		}
	}
	function stateChangedThree() { 
		if (xmlHttpThree.readyState==4 || xmlHttpThree.readyState=="complete") { 
			document.getElementById('ratingformbox').innerHTML=xmlHttpThree.responseText 
		} 
	} 
}

function showVideo(id) { 
	// document.getElementById(position).innerHTML="Please Wait";
	xmlHttpThree=GetXmlHttpObject()
	if (xmlHttpThree==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/videodelivery.cfm?id=" + id + "sid=" + Math.random();
	xmlHttpThree.onreadystatechange=stateChangedThree
	xmlHttpThree.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttpThree.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttpThree)	{
			xmlHttpThree.send()
		}
	}
	function stateChangedThree() { 
		if (xmlHttpThree.readyState==4 || xmlHttpThree.readyState=="complete") { 
			document.getElementById('videoboxdata').xmlHttpThree=xmlHttp.responseText 
		} 
	} 
}


function logout() { 
	// document.getElementById(position).innerHTML="Please Wait";
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support AJAX")
		return
	}
	var url="/loginrequest.cfm?logout&sid=" + Math.random();
	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.open("GET",url,true)
	if (window.XMLHttpRequest) {
		xmlHttp.send(null);
	} else if (window.ActiveXObject) {
		if(xmlHttp)	{
			xmlHttp.send()
		}
	}
	function stateChanged() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
			document.getElementById('loginbox').innerHTML=xmlHttp.responseText 
		} 
	} 
}
function GetXmlHttpObject() { 
	var objXMLHttp=null
	if (window.XMLHttpRequest) {
		objXMLHttp=new XMLHttpRequest()
	} else if (window.ActiveXObject) {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}
function GetXmlHttpObjectTwo() { 
	var objXMLHttp=null
	if (window.XMLHttpRequest) {
		objXMLHttp=new XMLHttpRequest()
	} else if (window.ActiveXObject) {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}

function GetXmlHttpObjectThree() { 
	var objXMLHttp=null
	if (window.XMLHttpRequest) {
		objXMLHttp=new XMLHttpRequest()
	} else if (window.ActiveXObject) {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}

function GetXmlHttpObjectFour() { 
	var objXMLHttp=null
	if (window.XMLHttpRequest) {
		objXMLHttp=new XMLHttpRequest()
	} else if (window.ActiveXObject) {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}

function popupAbout() { 
	 window.open("/pages/popup_about", "wttvabout","location=0,status=0,scrollbars=0,width=426,height=460"); 
}
function forgotPassword() { 
	 window.open("/pages/popup_password", "wttvpassword","location=0,status=0,scrollbars=0,width=426,height=330"); 
}

function emailLink(id) { 
	 window.open("/sendemail/" + id, "wttvemail","location=0,status=0,scrollbars=0,width=426,height=550"); 
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}


function goBack(pagetogo) { 
	window.location=pagetogo;
}

			function createRequestObject_qs() { 
				var req;
				if(window.XMLHttpRequest){ // Firefox, Safari, Opera...
					req = new XMLHttpRequest();
				} else if(window.ActiveXObject) { // Internet Explorer 5+
		  			req = new ActiveXObject("Microsoft.XMLHTTP");
				} else {  // There is an error creating the object,  // just as an old browser is being used.  
					alert('Problem creating the XMLHttpRequest object');
				} return req;
			}  
    		// Make the XMLHttpRequest object  
			var http = createRequestObject_qs();  
			function sendQuickSearch(q) {  
				// Open PHP script for requests  
				http.open('get', '/quicksearch.cfm?q='+q+'&sid='+Math.random());  
				http.onreadystatechange = handleResponse;  
				http.send(null);  
				function handleResponse() {
					if(http.readyState == 4 && http.status == 200){ // Text returned FROM the PHP script 
						var response = http.responseText;
						if(response) { // UPDATE ajaxTest content  
							document.getElementById('quicksearchresult').innerHTML = response;  
						}
					}
				}
			}  
			
			
			
