var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"

var bouncelimit=32 //(must be divisible by 8)
var direction="up"
function initbox(){
	if (!dom&&!ie&&!ns4)
	return
	crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
	scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
	crossobj.top=scroll_top-250+calunits
	crossobj.visibility=(dom||ie)? "visible" : "show"
	dropstart=setInterval("dropin()",50)
}
	
function dropin(){
	scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
	if (parseInt(crossobj.top)<100+scroll_top)
	crossobj.top=parseInt(crossobj.top)+40+calunits
	else{
	clearInterval(dropstart)
	bouncestart=setInterval("bouncein()",50)
	}
}
	
function bouncein(){
	crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
	if (bouncelimit<0)
	bouncelimit+=8
	bouncelimit=bouncelimit*-1
	if (bouncelimit==0){
	clearInterval(bouncestart)
	}
}
	
function dismissbox(){
	if (window.bouncestart) clearInterval(bouncestart)
	crossobj.visibility="hidden"
}

function truebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function dropornot(){
	if (get_cookie("droppedin")==""){
		window.onload=initbox
		createCookie("droppedin","yes",1)
	}
}


//var message="Please keep in mind that all work here (including graphics) is PROTECTED BY COPYRIGHT!";
//function clickIE4(){
//if (event.button==2){
//alert(message);
//return false;
//}
//}

//function clickNS4(e){
//if (document.layers||document.getElementById&&!document.all){
//if (e.which==2||e.which==3){
//alert(message);
//return false;
//}
//}
//}

//if (document.layers){
//document.captureEvents(Event.MOUSEDOWN);
//document.onmousedown=clickNS4;
//}
//else if (document.all&&!document.getElementById){
//document.onmousedown=clickIE4;
//}
//document.oncontextmenu=new Function("alert(message);return false");



var popunder=new Array()
popunder[0]="http://www.cig4u.com/tr/roi.asp?SRC=Cheap+Cig+Redirection&KW=enter"
popunder[1]="http://www.city-smokes.com?ovchn=OTHER&ovcpn=redirection&ovcrn=enter&ovrfd=www.cheap-cig.com&ovtac=AFF"
//popunder[2]="http://www.classadrivers.com"

// Specify the width and height of new popunder window (in pixels).
var width = '700'; 
var height = '450';

var p = 'scrollbars=yes,resizable=yes,toolbar=yes,' + //these are obvious variables. set "yes" or "no".
'menubar=yes,status=yes,location=yes,left=85,top=20,height=' +  //yes/no, & the screen location
height + ',width=' + width;

var one_time=1
function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if the cookie exists
      offset += search.length
      end = document.cookie.indexOf(";", offset); // set the index of beginning value
      
    if (end == -1) // set the index of the end of cookie value
         end = document.cookie.length;
         returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}


function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function introornot(){
	var documentreferrer;
	documentreferrer=document.referrer;
	var addr_str;
	addr_str="";
	var is_input = document.URL.indexOf('?');
	if (is_input != -1) { 
		// Create variable from ? in the url to the end of the string
		addr_str = '?' + document.URL.substring(is_input+1, document.URL.length);
	}
	if ((get_cookie('intro2smoke')=='') && (documentreferrer.indexOf('idevaffiliate')<0) && (documentreferrer.indexOf('cheap-cig2.com')<0) && (document.URL.indexOf('landpage=no')<0)) {
		createCookie('intro2smoke','yes');
		if (get_cookie('intro2smoke')=='yes') {
		window.location="/home/" + addr_str;
		}
	} else {
		createCookie('intro2smoke','yes');
	}
}

function loadornot(){
if (get_cookie('popunder')==''){
load_pop_power()
var days = 7;
var expires = new Date ();
expires.setTime(expires.getTime() + days * (24 * 60 * 60 * 1000)); 
document.cookie="popunder=yes; expires=" + expires.toGMTString();
}
}

function load_pop_power(){
	var	win1=window.open('http://www.cig4u.com/tr/roi.asp?SRC=Cheap+Cig+Redirection&KW=enter',"Cig4u");
	win1.blur();
	window.focus();
	var win2=window.open('http://www.city-smokes.com?ovchn=OTHER&ovcpn=redirection&ovcrn=enter&ovrfd=www.cheap-cig.com&ovtac=AFF',"CitySmokes");
	win2.blur();
	window.focus();
	}
//introornot();
//if (one_time==0) {
	//load_pop_power()
//}
//else {
	//loadornot()
//}