function Winder (x) 
{
    if(!window.open(x,'Comments','width=400,height=480,scrollbars=yes,status=yes'))
    	alert('popup blocked');
}



function dispExif(action)
{
	if (action == 1)
	{
		display = 'block';
	}
	else
	{
		display = 'none';
	}
	document.getElementById('fullexif').style.display = display;
}

function windowResized()
{
	var windowWidth = 0, myHeight = 0;
	if (typeof( window.innerWidth ) == 'number' )
	{
		//Non-IE
		windowWidth = window.innerWidth;
	}
	else if (document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
	{
		//IE 6+ in 'standards compliant mode'
		windowWidth = document.documentElement.clientWidth;
	}
	else if (document.body && ( document.body.clientWidth || document.body.clientHeight ) )
	{
		//IE 4 compatible
		windowWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	
	if (windowWidth < 995)
	{
			document.getElementById('content-col2').className = 'narrow';
			document.getElementById('content-main').style.minHeight = 0;
	}
	else
	{
			document.getElementById('content-col2').className = '';
			document.getElementById('content-main').style.minHeight = '650px';
	}
}

function copy_address(copy)
{
	fields = new Array('name','company','address_1','address_2','city','state','zip','phone');
	copy_to         = 'shipping';
	copy_from       = 'billing';
	if (copy == 'billing')
	{
		copy_to         = 'billing';
		copy_from       = 'shipping';
	}
	for (i=0; i<fields.length; i++)  
	{
		document.getElementById(copy_to + '_'+fields[i]).value = document.getElementById(copy_from + '_'+fields[i]).value;
	}
}

// Style switching junk
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }

  
  createCookie("style", title, 365);
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}
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 expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(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;
}

