//<![CDATA[
var email = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
function ccValidator2(ccnum,typeIdx) {
	var ret;
	var checkSum = 0;
	var iMult = 0;
	for(var i=ccnum.length;i>0;i--) {
		iDigit = (iMult % 2 + 1) * parseInt(ccnum.substring(i-1,i));
		checkSum += (iDigit > 9) ? (iDigit - 9) : iDigit;
		iMult++;
	}//for
	ret = (checkSum % 10 == 0);
	if(!ret) return ret; 
	//typeindex 1=visa;2=ax;3=mc;4=dc
	switch (typeIdx) {
		case 1:
		case "V":
			return (ret && ( /^(4\d{3}-?\d{4}-?\d{4}-?\d{4})/.test(ccnum)));
		case 2:
		case "A":
			return (ret && ( /^3[4,7]\d{13}$/.test(ccnum)));
		case 3:
		case "M":
			return (ret && ( /^(5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4})/.test(ccnum)));
		case 4:
		case "D":
			return (ret && ( /^((6011)-?\d{4}-?\d{4}-?\d{4})/.test(ccnum)));
		default:
			return false;
	}//switch
}//ccValidator


function viewLayer(url) {
	var loader = new bbfn_ControlLoader(url + '?t=' + new Date().valueOf());
	loader.loadCtrl();
	this.response = function(retValue) {
		loader.closeCtrl();
	}//this
}

function faq_onclick(el) {
	try {
		var pn = el.parentNode;
		var answer = pn.getElementsByTagName("div")[0];
		var display = answer.style.display;
		answer.style.display = (display == "block") ? "none" : "block";
	}catch(e){}
}

function trim(element) {
	var sTrim;
	if(element.name) {
		sTrim = element.value.replace(/(^\s+)|(\s+$)/g, "");
		element.value = sTrim;
	}else{
		sTrim = element.replace(/(^\s+)|(\s+$)/g, "");
	}
	return sTrim;
}//trim




function init_tooltip() {
	document.enabletip=false;
	document.ie=(document.all)?true:false;
	document.ns6=document.getElementById && !document.all;
	document.offsetfromcursorX = 12;
	document.offsetfromcursorY = 10;
	document.offsetdivfrompointerX = 10;
	document.offsetdivfrompointerY = 14;
	if (document.ie||document.ns6) {
		document.write('<div id="dhtmltooltip"></div>'); //write out tooltip DIV
		document.write('<img id="dhtmlpointer" src="/images/lang/en/arrow2.gif">'); //write out pointer image
		document.tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "";
		document.pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : "";
	}
}
function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body;
}
function ddrivetip(thetext, thewidth, thecolor){
	var ns6 = document.ns6;
	var ie=document.ie;
	if (ns6||ie){
		var tipobj = document.tipobj;
		if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px";
		if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor;
			tipobj.innerHTML=thetext;
		document.enabletip=true;
		return false;
	}
}
function positiontip(e){
	var enabletip = document.enabletip;
	if (enabletip){
		var ns6=document.ns6,ie=document.ie;
		var tipobj = document.tipobj;
		var pointerobj = document.pointerobj;
		var offsetfromcursorX=document.offsetfromcursorX;
		var offsetfromcursorY=document.offsetfromcursorY;
		var offsetdivfrompointerX=document.offsetdivfrompointerX;
		var offsetdivfrompointerY=document.offsetdivfrompointerY;
		
		var nondefaultpos=false;
		var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
		//Find out how close the mouse is to the corner of the window
		var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20;
		var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20;
		var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX;
		var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY;
		var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000;
		//if the horizontal distance isn't enough to accomodate the width of the context menu
		if (rightedge<tipobj.offsetWidth){
			//move the horizontal position of the menu to the left by it's width
			tipobj.style.left=curX-tipobj.offsetWidth+"px";
			nondefaultpos=true;
		} else if (curX<leftedge)
			tipobj.style.left="5px";
		else {
			//position the horizontal position of the menu where the mouse is positioned
			tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
			pointerobj.style.left=curX+offsetfromcursorX+"px"
		}

		//same concept with the vertical position
		if (bottomedge<tipobj.offsetHeight){
			tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px";
			nondefaultpos=true;
		}else{
			tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px";
			pointerobj.style.top=curY+offsetfromcursorY+"px";
		}
		tipobj.style.visibility="visible";
		pointerobj.style.visibility = (!nondefaultpos) ? "visible" : "hidden";
	}
}

function hideddrivetip(){
	var ns6=document.ns6,ie=document.ie;
	if (ns6||ie){
		document.enabletip=false;
		document.tipobj.style.visibility="hidden";
		document.pointerobj.style.visibility="hidden";
		document.tipobj.style.left="-1000px";
		document.tipobj.style.backgroundColor='';
		document.tipobj.style.width='';
	}
}
function viewSummary(el) {
	var pn = el.parentNode;
	var summary = pn.getElementsByTagName("div")[0];
	var disp = summary.style.display;
	summary.style.display = (disp == "block") ? "none" : "block";
}


// Original JavaScript code by Duncan Crombie: dcrombie at chirp.com.au
// Please acknowledge use of this code by including this header.
var bites = document.cookie.split("; "); // break cookie into array of bites

function getCookie(name) { // use: getCookie("name");
	for (var i=0; i < bites.length; i++) {
		nextbite = bites[i].split("="); // break into name and value
		if (nextbite[0] == name) // if name matches
			return unescape(nextbite[1]); // return value
	}
	return null;
}

	

function setCookie2(name, value) { // use: setCookie("name", value);
	if (value != null && value != "")
		document.cookie=name + "=" + escape(value) // + "; expires=" + expiry.toGMTString();
	bites = document.cookie.split("; "); // update cookie bites
}

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");

	document.cookie = curCookie;
}

function _xyProgressBar(args) {
	var barWidth = 488;
	var iNumCells = 10;
	var cWidth = 18;
	var height = 14;
	var delay = 100;
	var background = "#6666ff";
	var borderColor = "#cccccc";
	var startAt = -1;
	var bar = "xBar1";
	var container = "xBarContainer1";
	var totalBarWidth = barWidth+((iNumCells+1)*(cWidth+1));
	if(args) {
		if(args["barwidth"])
			barWidth = args["barwidth"];
	}
		
	document.write("<div style=\"height:"+height+"px;\">");		
	document.write("<div style=\"position:absolute;padding:1px 0px;border: 1px solid "+borderColor+";width:"+barWidth+"px; overflow: hidden; height:"+height+"px;\">");
	document.write("<div id=\""+container+"\" style=\"width:"+totalBarWidth+"px;position:absolute;left:-0px;top:1px;white-space:nowrap;\">");			
	document.write("<table id=\""+bar+"\"><tr>");
	for(var i=1;i<=iNumCells;i++)
		document.write("<td style=\"border-right:1px solid #ffffff;width: "+cWidth+"px;height:"+height+"px;background-color:"+background+";\">&nbsp;<\/td>");
	document.write("<\/tr><\/table>");
	document.write("<\/div>");
	document.write("<\/div>");
	document.write("<\/div>");
	
	var startingPos = (startAt-iNumCells)*(cWidth+1);
	document.getElementById(container).style.left = startingPos +"px";
	
	__doScroll = function (){
		var el = document.getElementById(container);
		var left = parseInt(el.style.left,10);
		if(left < barWidth)
			el.style.left = (left + (cWidth+1)) + 'px';
		else
			el.style.left = startingPos + 'px';
	}
	window.setInterval(__doScroll,delay);	
}







//]]>
