function openWin(quelle)
{
popup = window.open('detail.htm?' + quelle,'thewindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,innerwidth=600,height=450,innerheight=450');
 popup.focus();
}

function openCartWin(url)
{
popup = window.open(url,'thewindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=550,innerwidth=550,height=300,innerheight=300');
 popup.focus();
}

/*
 * resize.js 0.3 970811
 * by gary smith
 * js component for "reloading page onResize"
 */

if(!window.saveInnerWidth) {
  window.onresize = resizeIt;
  window.saveInnerWidth = window.innerWidth;
  window.saveInnerHeight = window.innerHeight;
}

function resizeIt() {
    if (saveInnerWidth < window.innerWidth || 
        saveInnerWidth > window.innerWidth || 
        saveInnerHeight > window.innerHeight || 
        saveInnerHeight < window.innerHeight ) 
    {
        window.history.go(0);
    }
}

/* Following code by Rob Stevenson of codeMaker Systems */
/* If you use this code please leave the author line intact */

var alphabet_lcase = "abcdefghijklmnopqrstuvwxyz";
var alphabet_ucase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var numeric = "0123456789"

/* Validate the format of an email address */
function checkEmail(email) {
    var atIndex;
    var dotIndex;
    atIndex=email.value.indexOf("@");
    dotIndex=email.value.lastIndexOf(".");
    if (atIndex<1 || dotIndex<1 || dotIndex-atIndex<2 || email.value.length-dotIndex<3 || email.value.length-dotIndex>4)
        return false;
    else
	return true;
}

/* Function to set focus in specified element. */
function fixElement(element, message) {
    alert(message);
    element.focus();
}

function toProperCase(theString) {
    var ptr;
    var currChar;
    var prevChar=null;
    var lboChar=null;
    var newString="";

    if (theString == null)
        return;

    for (ptr = 0; ptr<theString.length; ptr++) {
        currChar = theString.charAt(ptr);

	if ((alphabet_lcase.search(prevChar) != -1) || (alphabet_ucase.search(prevChar) != -1)) 
	    currChar=currChar.toLowerCase();
	else
	    currChar=currChar.toUpperCase();

	//Convert trailing capitals after apostrophe e.g. Lord'S to Lord's
        if (prevChar == "'" && alphabet_lcase.search(lboChar) != -1)
            currChar=currChar.toLowerCase();

	newString=newString+currChar;
        lboChar = prevChar;
        prevChar = currChar;
    }
    return newString;
}

/* Convert mm/yy date to months */
function YYMM2Months(txtDate) {
    var iMonth;
    var iYear;
    var sDate = new String(txtDate);
    var oblIndex;
    
    if (sDate.length > 0) {
	if (sDate.length != 5) return -1; 
	oblIndex=sDate.indexOf("/");
	if (oblIndex == 0) oblIndex=2;
	if (isNaN(sDate.slice(0,2))) return -1;
	iMonth = parseInt(sDate.slice(0,2),10);
	if (iMonth > 0 && iMonth < 13) {
	    if (isNaN(sDate.slice(oblIndex+1,oblIndex+3))) return -1;
	    iYear = parseInt(sDate.slice(oblIndex+1,oblIndex+3),10);
	    if (iYear <= 50)
		iYear = iYear + 2000
	    else
		iYear = iYear + 1900;
	    return (iYear * 12) + iMonth;
	    }
	else
	    return -1;
	}
    else
	return -1;
}

function fmtFtrDate() {
var now = new Date();
var d = new String(now.getDate());
var m = new String(now.getMonth()+1);
var y = now.getYear();
if (d.length == 1) d = "0" + d;
if (m.length == 1) m = "0" + m;
if (y < 1000) {y += 1900};
return (d + "." + m + "." + y);
}

function fmtDate() { 
// Array of day names
var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

// Array of month Names
var monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");

var now = new Date();
var y = now.getYear();
if (y < 1000) {y += 1900};
return (dayNames[now.getDay()] + ", " + monthNames[now.getMonth()] + " " + now.getDate() + ", " + y);
}

function fmtNow() { 
// Array of day names
var dayNames = new     Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

// Array of month Names
var monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");

var now = new Date();
var h = new String(now.getHours());
var m = new String(now.getMinutes());
var y = now.getYear();
if (h.length == 1) h = "0" + h;
if (m.length == 1) m = "0" + m;
if (y < 1000) {y += 1900};
return (h + ":" + m + " on " + dayNames[now.getDay()] + ", " + monthNames[now.getMonth()] + " " + now.getDate() + ", " + y);
}
  
function isMac() { return(navigator.appVersion.indexOf("Mac") != -1);}
function isWebTV() { return(navigator.userAgent.indexOf('WebTV') > 0);}
function isNS() { return(navigator.appName.indexOf("Netscape") != -1);}
