function isEmail(str) {
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
    var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
    var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$");
    return (!r1.test(str) && r2.test(str));
}

function openNewletterWin(wName, wWidth, wHeight, wResize) {
	if(isEmail(document.optin.OILB_EMAIL.value) == "") {
		alert("Your e-mail address seems not to be valid.");
		document.optin.OILB_EMAIL.focus();
		return false;
	}else{
		features = 'top=0,left=0,scrollbars=1,status=0,resizable=' + ((wResize) ? 0 : 0) + ((wWidth) ? ',width=' + wWidth : '') + ((wHeight) ? ',height=' + wHeight : '');
		popWin = window.open('', wName, features);
		if(popWin.focus) { popWin.focus(); }
		return true;
	}
}

function makeWin(imsrc, ww, wh) {
	ww=ww+25; wh=wh+50;
	w1=window.open('','w1','width='+ww+',height='+wh+',status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
	w1.document.open();
	w1.document.write("<html><head><title>Image Zoom<\/title><META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\"><META HTTP-EQUIV=\"Expires\" CONTENT=\"-1\"><\/head>");
	w1.document.write("<body bgcolor='#FFFFFF' text='#000000' leftmargin=2 topmargin=10><p align=center>");
	w1.document.write("<a href=javascript:close();><img border=0 title=\"Click to Close\" alt=\"Click to Close\" name=theimg src=" + imsrc + "></a><br>");
	w1.document.write("<a href=\"javascript:window.close();\"><font size=1 face=tahoma color=#000000>close window<\/font><\/a><\/body><\/html>");
	w1.document.focus();
};

function HighLightCellsOne(x){
var els = document.getElementById("orderform").getElementsByTagName("input");
var c=0;
	for (i=0;i<els.length;i++)
		if (els[i].type=="radio") 
			c++;
	for (i=0;i<c;i++) {
			therow = document.getElementById("rowBgColor" + i);
			if (therow)
			therow.style.backgroundColor = (x==i) ? "#EBEBEB" : "#FFFFFF";
	}
}

function HighLightCells(x){
	var opts = document.getElementById('opt_div').getElementsByTagName('input');
	for (i=0;i<opts.length;i++){
		if(opts[i].type == 'radio'){
			if(opts[i].checked){
				opts[i].parentNode.className = "grey";
			}else{
				opts[i].parentNode.className = "white";
			}
		}
	}
	//alert(x.parentNode.innerHTML)
}

function OnloadHighLightCells(){
	var opts = document.getElementById('opt_div').getElementsByTagName('td');
	for (i=0;i<opts.length;i++){
		var charone = opts[i].id.charAt(opts[i].id.length - 1);
		var chartwo = opts[i].id.charAt(opts[i].id.length - 2);	
		var therow = "rowBgColor0";	
		if(charone == "1" && chartwo == " "){
			document.getElementById(opts[i].id).className = "grey";
		}
		else if(document.getElementById(therow) && i == 0) {
			document.getElementById(therow).className = "grey";
			}		
	}
}