// JavaScript Document
var xmlHttp;
var reviews;



function showReviews(key, startRecord)
{ 
var url="/reviews/includes/displayReviews.php?key=" + key + "&startRecord=" + startRecord
reviews = "reviews"
xmlHttp=GetXmlHttpObject(reviewStateChanged)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
if (xmlHttp.status == 200) {
    // perfect!
	} else {
 alert('There was a problem with the request.'); 
    // there was a problem with the request,
    // for example the response may be a 404 (Not Found)
    // or 500 (Internal Server Error) response codes
	}

// Check error states of codes here

} 


function showOffer(id)
{ 
var url="/offers.php?filter=display&id=" + id
offerdetails = "offerdetails" + id
xmlHttp=GetXmlHttpObject(stateChanged)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
if (xmlHttp.status == 200) {
    // perfect!
	} else {
 alert('There was a problem with the request.'); 
    // there was a problem with the request,
    // for example the response may be a 404 (Not Found)
    // or 500 (Internal Server Error) response codes
	}

// Check error states of codes here

} 


function showOffer1(id, action)
{ 
var url="/offers.php?filter=display&id=" + id + "&action=" + action
offerdetails = "offerdetails" + id + action
xmlHttp=GetXmlHttpObject(stateChanged)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
if (xmlHttp.status == 200) {
    // perfect!
	} else {
 alert('There was a problem with the request.'); 
    // there was a problem with the request,
    // for example the response may be a 404 (Not Found)
    // or 500 (Internal Server Error) response codes
	}

// Check error states of codes here

} 
//function showTabbedOffer(id)
//{ 
//var url="/mobile-broadband/tabbedOffers.php?id=" + id
//offerdetails = "offerdetails1"
//xmlHttp=GetXmlHttpObject(stateChanged)
//xmlHttp.open("GET", url , true)
//xmlHttp.send(null)
//if (xmlHttp.status == 200) {
    // perfect!
//	} else {
// alert('There was a problem with the request.'); 
    // there was a problem with the request,
    // for example the response may be a 404 (Not Found)
    // or 500 (Internal Server Error) response codes
//	}

// Check error states of codes here

//} 


function closeOffer(offerid)
{ 
document.getElementById("offerdetails" + offerid).innerHTML='<a href="javascript:;"  onclick="showOffer(' + offerid + ')" title="Click for further details about this offer">' + '<strong>[View details]</strong></a>'
}

function closeOffer1(offerid,action)
{ 
document.getElementById("offerdetails" + offerid + action).innerHTML='<a href="javascript:;"  onclick="showOffer1(' + offerid + ',\'' + action + '\')" title="Click for further details about this offer">' + '<strong>[View details]</strong></a>'
}

function reviewStateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById(reviews).innerHTML=xmlHttp.responseText 
} 
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById(offerdetails).innerHTML=xmlHttp.responseText 
} 
} 

function GetXmlHttpObject(handler)
{ 
var objXmlHttp=null

if (navigator.userAgent.indexOf("Opera")>=0)
{
alert("This example doesn't work in Opera") 
return 
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{ 
var strName="Msxml2.XMLHTTP"
if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.XMLHTTP"
} 
try
{ 
objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler 
return objXmlHttp
} 
catch(e)
{ 
alert("Error. Scripting for ActiveX might be disabled") 
return 
} 
} 
if (navigator.userAgent.indexOf("Mozilla")>=0)
{
objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler 
return objXmlHttp
}
} 


