var cmpgn;
function showColonCleanseArticle()
{
	ajaxDraw('coloncleanseArticle','/includes/AJAXFuncs/index.asp?AAction=ColonCleanseExposed');
	
}

function skipAd()
{
	ajaxDraw('errDiv','/includes/AJAXFuncs/index.asp?AAction=SkipAd');
	document.getElementById('divMainC').style.display='block';
	document.getElementById('advert').style.display='none';
	document.getElementById('body').className="regularBodyClass";
	document.getElementById('skipAdLink').style.display='none';
	
}

function showTopAd(cmpgn)
{
	document.getElementById('body').className="adClass";
	document.getElementById('divMainC').style.display='none';
	document.getElementById('advert').style.display='block';
	
	if (cmpgn=='colonKeyword'){
		ajaxDraw('advert','/includes/AJAXFuncs/index.asp?AAction=ColonCleanseExposed&cmpgn='+cmpgn);
		}
	else if(cmpgn='BreastEhanceAd'){
		ajaxDraw('advert','/includes/AJAXFuncs/index.asp?AAction=BreastEhanceAd&cmpgn='+cmpgn);
	}
	
	
}

function postAdminAjax(lngValidate,strAction,strValues,strHideID,strAlertMsg)
{
	
	if(lngValidate==1)
		{
		
			if(confirm('Are you sure you wish to delete this record?'))
				{
					postAjaxForm('/admin/ajax.asp','?PageAction='+strAction+'&'+strValues);
					
					if(strHideID.length > 0)
					{
						document.getElementById(strHideID).style.display='none';
					}
					
					if(strAlertMsg.length > 0)
						{
							alert(strAlertMsg);
						}
					}
			
					void(0);
		}
	else
	{
		postAjaxForm('/admin/ajax.asp','?PageAction='+strAction+'&'+strValues);
			
		if(strHideID.length > 0)
		{
			document.getElementById(strHideID).style.display='none';
		}
		
		if(strAlertMsg.length > 0)
		{
			alert(strAlertMsg);
		}
	}		
	
	

}

var http = getXMLHTTPRequest();

function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
    try {
    req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (err2) {
        try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (err3) {
            req = false;
        }
    }
}
return req;
}

function postAjaxForm(strURL,strFields)
{
	
	//alert(strURL + strFields);
	
	//alert(strFields);
	
	http.open("POST",strURL+strFields,true);
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//http.setRequestHeader("Content-type", "text/html");
	http.setRequestHeader("Content-length", strFields.length);
	http.setRequestHeader("Connection", "close");

	http.send(strFields);
	
}

function getServerTime() {
    var myurl = 'login.asp';
    myRand = parseInt(Math.random()*999999999999999);
    var modurl = myurl+"?rand="+myRand;
    http.open("GET", modurl, true);
    http.onreadystatechange = useHttpResponse;
    http.send(null);

}



var ie=document.all;
var nn6=document.getElementById&&!document.all;

var isdrag=false;
var x,y;
var dobj;

function movemouse(e)
{
  if (isdrag)
  {
    dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;
    dobj.style.top  = nn6 ? ty + e.clientY - y : ty + event.clientY - y;
    return false;
  }
}

function selectmouse(e) 
{
  var fobj       = nn6 ? e.target : event.srcElement;
  var topelement = nn6 ? "HTML" : "BODY";

  while (fobj.tagName != topelement && fobj.className != "dragme")
  {
    fobj = nn6 ? fobj.parentNode : fobj.parentElement;
  }

  if (fobj.className=="dragme")
  {
    isdrag = true;
    dobj = fobj;
    tx = parseInt(dobj.style.left+0);
    ty = parseInt(dobj.style.top+0);
    x = nn6 ? e.clientX : event.clientX;
    y = nn6 ? e.clientY : event.clientY;
    document.onmousemove=movemouse;
    return false;
  }
}


