function newWindow(url,name,w,h,scroll,resizable)
{
  l = (screen.availWidth && screen.availWidth > w) ? (Math.floor((screen.availWidth - w) / 2)) : 0;
  t = (screen.availHeight && screen.availHeight > h) ? (Math.floor((screen.availHeight - h) / 2)) : 0;

  popUp = window.open(url, name,'width='+w+',height='+h+',top='+t+',left='+l+',toolbar=0,directories=0,menubar=0,status=0,resizable='+resizable+',location=0,scrollbars='+scroll+',copyhistory=0');
  popUp.focus();
}

function toggleBtn(el, btnid)
{
 	var btn = document.getElementById(btnid);  
 	if(el.checked)
	{
	   i = 0;
	   btn.className='btn';
	   btn.onclick = retValT;
	} 
	else
	{
	  btn.className='btn-disabled';
	  btn.onclick = retValF;
	}
}

function retValF()
{
	alert('You have to agree to our terms and conditions before continuing with your order!');
	return false;
}

function retValT()
{
	if(i == 0) 
	{
	    document.getElementById('optinform').submit();
	    this.className='btn-disabled'; 
	    this.onclick = function(){return false;};
	}                                 
	i++; 
	return false;
}

function setCookie(name,value,days)
{
	 var expires;
	 if (days)
	 {
	  	var date = new Date();
	  	date.setTime(date.getTime()+(days*24*60*60*1000));
	  	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;
} 

String.prototype.ucFirst = function () 
{
   return this.substr(0,1).toUpperCase() + this.substr(1,this.length);
};