// Bookmark Script

function bookmark()
{
	var i = navigator.userAgent.indexOf("Netscape");
	if(i >= 0)
	{
		alert("Press Ctrl + D to Bookmark this Page");
	}
	else if (window.sidebar) // firefox
	{
		alert("Press Ctrl + D to bookmark");
	}
	else if(window.opera && window.print)
	{ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',"http://www.eFlasks.com/");
		elem.setAttribute('title',document.title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all)// ie
	{
		//window.external.AddFavorite(window.location, document.title);
		window.external.AddFavorite("http://www.eFlasks.com/", "Flasks - Engraved Flasks -  Personalized Liquor Flask Gift Sets");
	}
	else
	{
		alert("Press Ctrl + D to Bookmark this page");
	}
}


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 GetCookie(name) 
{  
	var nameEQ = 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(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function checkCookie(id, name, path)
{

		var height=0;
		var username = GetCookie('eflasks_Recent');

		if(username=='2')
		{
		 	height=150;
		 	str='<iframe align="middle" src="' + path + '/scripts/recent_view.php?name=' + name + '&id='+ id + '&path=' + path + '" width="165" height="' + height + '" scrolling="no" frameborder="0"></iframe>';
			document.write(str);

		}
		else if(username=='1')
		{
			createCookie('eflasks_Recent','2');
			height=100;
			str='<iframe align="middle" src="' + path + '/scripts/recent_view.php?name=' + name + '&id='+ id + '&path=' + path + '" width="165" height="' + height + '" scrolling="no" frameborder="0"></iframe>';
			document.write(str);
		}
		else if(name!='None' && id!='None')
		{
			createCookie('eflasks_Recent','1');
str='<iframe align="middle" src="' + path + '/scripts/recent_view.php?name=' + name + '&id='+ id + '&path=' + path + '" width="171" height="' + height + '" scrolling="no" frameborder="0" style="display:none;"></iframe>';
document.write(str);

		}
		
		
}



// Popup Wholesale Registration

var popWin = null    // use this when referring to pop-up window
var winCount = 0
var winName = "popWin"
function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
  var d_winLeft = 20  // default, pixels from screen left to window left
  var d_winTop = 20   // default, pixels from screen top to window top
  winName = "popWin" + winCount++ //unique name for each pop-up window
  closePopWin()           // close any previously opened pop-up window
  if (openPopWin.arguments.length >= 4)  // any additional features? 
    winFeatures = "," + winFeatures
  else 
    winFeatures = "" 
  if (openPopWin.arguments.length == 6)  // location specified
    winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
  else
    winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
  popWin = window.open(winURL, winName, "width=" + winWidth 
           + ",height=" + winHeight + winFeatures)
  }
function closePopWin(){    // close pop-up window if it is open 
  if (navigator.appName != "Microsoft Internet Explorer" 
      || parseInt(navigator.appVersion) >=4) //do not close if early IE
    if(popWin != null) if(!popWin.closed) popWin.close() 
  }
function getLocation(winWidth, winHeight, winLeft, winTop){
  return ""
  }
// for Netscape 4+ and IE 4+
function getLocation(winWidth, winHeight, winLeft, winTop){
  var winLocation = ""
  if (winLeft < 0)
    winLeft = screen.width - winWidth + winLeft
  if (winTop < 0)
    winTop = screen.height - winHeight + winTop
  if (winTop == "cen")
    winTop = (screen.height - winHeight)/2 - 20
  if (winLeft == "cen")
    winLeft = (screen.width - winWidth)/2
  if (winLeft>0 & winTop>0)
    winLocation =  ",screenX=" + winLeft + ",left=" + winLeft	
                + ",screenY=" + winTop + ",top=" + winTop
  else
    winLocation = ""
  return winLocation
  }