//var site_url_ads='http://61.246.241.37/vcad/';

/*add your url where you upload code*/
var site_url_ads='http://www.path2usa.com/insurance/roadblock/';

var main_ad_site_url=window.top.location;

var anchor_url='http://www.visitorscoverage.com';//link of site where you want to redirect user

var image_path=site_url_ads+'vc_ad.jpg';

function closediv(){
	document.getElementById('setroadpop').style.display='none';
}


function showclose(){
document.getElementById('closeimage').style.display='';
}

var expDays = 1;

function GetCookie (name) { 
  var arg = name + "="; 
  var alen = arg.length; 
  var clen = document.cookie.length; 
  var i = 0; 

  while (i < clen) { 
    var j = i + alen; 

   if (document.cookie.substring(i, j) == arg) 
       return getCookieVal (j); 

      i = document.cookie.indexOf(" ", i) + 1; 

 if (i == 0) break; 

} 

return null;

}

function SetCookie (name, value) { 
  var argv = SetCookie.arguments; 
  var argc = SetCookie.arguments.length; 
  var expires = (argc > 2) ? argv[2] : null; 
  var path = (argc > 3) ? argv[3] : null; 
  var domain = (argc > 4) ? argv[4] : null; 
  var secure = (argc > 5) ? argv[5] : false; 
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) + 
((domain == null) ? "" : ("; domain=" + domain)) + 
((secure == true) ? "; secure" : "");

}

function DeleteCookie (name) { 
  var exp = new Date(); 
  exp.setTime (exp.getTime() - 1); 
  var cval = GetCookie (name); 
  document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();

}

var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function amt(){
  var count = GetCookie('adscount')
   
  if(count == null) {
    SetCookie('adscount','1')
    return 1
} else {
   var newcount = parseInt(count) + 1;
   DeleteCookie('adscount')
   SetCookie('adscount',newcount,exp)
return count

}

}

function getCookieVal(offset) {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1)
     endstr = document.cookie.length;
     return unescape(document.cookie.substring(offset, endstr));
}



function getRecords(type_ads){

var url = site_url_ads+"ads_query.php?main_ad_site_url="+main_ad_site_url+"&type="+type_ads;

httpads.open("GET", url, true);
httpads.onreadystatechange = handleHttpResponseads;
httpads.send(null);
}

 // The server-side script
function handleHttpResponseads() {
  if (httpads.readyState == 4) {
			
  }
}

function getHTTPObjectads() {

  var xmlhttpads;

 if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttpads=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttpads=new ActiveXObject("Microsoft.XMLHTTP");
  }
	return xmlhttpads;

}
var httpads = getHTTPObjectads(); // We create the HTTP Object


function showpopheight(){
var theHeight;
if (window.innerHeight) {
theHeight=window.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight) {
theHeight=document.documentElement.clientHeight;
}
else if (document.body) {
theHeight=document.body.clientHeight;
}
return theHeight;
}

//function showpopupads(){

 var count = GetCookie('vcadcount');
 if (count == null) {
    count=1;
    SetCookie('vcadcount', count, exp);

//heightpop=showpopheight();

    document.write('<div id="setroadpop" style="position:absolute; width:100%; height:2500px; background-color:#666;opacity:.9;filter: alpha(opacity=50);top:0px; left:0px;padding:0px; align="center"></div><div  id="setroadpopimg" style="position:absolute;width:600px; height:400px; margin:auto; top:15%; left:30%;z-index: 1000; " align="center"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td width="21"></td><td  align="right"><b><a href="javascript:void(0)" onclick="document.getElementById(\'setroadpop\').style.display=\'none\';document.getElementById(\'setroadpopimg\').style.display=\'none\';" ><span id="closeimage" style="display:none; background:#fff; padding:5px; width:500;text-align:center;color:#00447b;">Continue to path2usa</span></a></b></td><td width="21" align="right"></td></tr><tr><td width="21"><img src="'+site_url_ads+'images/s-TL.png" width="21" height="20" /></td><td style="background-image:url('+site_url_ads+'images/s-Top.png); background-repeat:repeat-x;" align="right"></td><td width="21" align="right"><img src="'+site_url_ads+'images/s-TR.png" width="21" height="20" /></td></tr><tr><td style="background-image:url('+site_url_ads+'images/s-Lft.png); background-repeat:repeat-y;">&nbsp;</td><td bgcolor="#FFFFFF" align="right"><a href="'+anchor_url+'" onclick="getRecords(\'2\');"><img src="'+image_path+'" border="0"/></a></td><td align="right" style="background-image:url('+site_url_ads+'images/s-Rgt.png); background-repeat:repeat-y;">&nbsp;</td></tr><tr><td><img src="'+site_url_ads+'images/s-BL.png" alt="" width="21" height="20" /></td><td style="background-image:url('+site_url_ads+'images/s-Btm.png); background-repeat:repeat-x;">&nbsp;</td><td align="right"><img src="'+site_url_ads+'images/s-BR.png" alt="" width="21" height="20" /></td></tr></table></div>');

    setTimeout("showclose();",2000);

    // store ad impression
    getRecords('1');
 }
//} 

//window.onload=showpopupads();


