
//begin cookie stuff
var expDays = 1; // number of days the cookie should last

var page = "http://solmentum.com/wp-content/themes/solmentum/popover.html";

var cookie_name = "popCookie";

var $j = jQuery.noConflict();


var exp = 1;   // the number at the left reflects the number of days for the cookie to last
               // modify it according to your needs

function newCookie(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 readCookie(name) {
   var nameSG = name + "=";
   var ca = document.cookie.split(';');
  for(var i=0; i<ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
  if (c.indexOf(nameSG) == 0) return c.substring(nameSG.length,c.length); }
    return null; }

function amt() {
  var num = readCookie(cookie_name);
  //alert(num);
  if (num < 1) { 
  newCookie(cookie_name,'testcookie1', exp);
  popWindow();
  }
}



window.onload=amt;
//temp bypass cookie
//window.onload=popWindow;

//end cookie stuff

//begin fancy box stuff for popup overlay

function autoClose(){
	//alert("I am here");
         setTimeout ('$j.fancybox.close ()', 10000);
}

// Use jQuery via $j(...) instead of $(..)

function popWindow(){
	//alert("I am here");
	$j.fancybox(
		page,
		{
        	'autoDimensions'	: false,
			'width'         		: 500,
			'height'        		: 350,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'showCloseButton' : false,
			 'callbackOnShow' : autoClose(),
			'type' : 'iframe'
		}
	);
}

//end fancy box stuff
