// Browser & OS Detection for .css files
						
// Roll Over Images
var arTemp = 3
function chgImage(newImage,ar) {
catImage.src = newImage;
document["ar" + arTemp].src = "/images/spacer.gif";
document["ar" + ar].src = "<% = G_STR_IMG_PATH_DIVIMAGE_PATH %>home/redarrow.gif"
arTemp = ar
}

// Memory Configurator
function SimpleConfigurator()
{
	remote = window.open ("","remotewin", "status=yes,toolbar=yes,menubar=no,location=no, resizable=yes, width=600,height=400, top=50,left=200");
	remote.location.href = "http://206.16.197.3/companies/Creative/index.shtml";
	if (remote.opener == null)
	{
		remote.opener = window;
	}
	remote.opener.name = "opener";
}

var dialog = new Object()

function PeripheralConfigurator(){
dialog.win = window.open("http://www.peripheralconfigurator.com/creative/pcmall/pcmall.htm","Test","width=800,height=600,menubar=yes,scrollbars=yes,status=no,toolbar=yes")

}

function VikingConfigurator(){
if (!dialog.win || (dialog.win && dialog.win.closed)){
dialog.win = window.open("http://config.vikingcomponents.com/pcmall/default.asp?returnurl=http://www.cc-inc.com/pcmall/shop/cart/cart_item.asp&action=add", "Viking", "width=600,height=400,menubar=no,scrollbars=yes,status=no")
dialog.win.focus()
	}else{
	dialog.win.focus
	}
}

function KingstonConfigurator(){
dialog.win = window.open("http://www.ec.kingston.com/ecom/default.asp?referid=69&returnurl=http://www.cc-inc.com/cart/additem.asp?quantity=1","KingstonMemoryConfigurator","height=480,width=640,menubar=no,scrollbars=yes,status=no")
}


//Script for Education Section of Rep Locator(/co_pcmall/div_pcmall/information/goved/tools_resources/rep_locator.asp)
function goHere(newLoc)	{
	newPage = newLoc.options[newLoc.selectedIndex].value;
	if (newPage != "") {
		window.location.href = newPage;
		//alert(newLoc.options[newLoc.selectedIndex].value);
	}
}

function errNoImage(objImage) {
	objImage.src = "/images/spacer.gif";
}
	
function openAvailabilityLegend() {
window.open("/pcmall/shop/tools/availability_legend.asp","thisName","menubar=no,status=no,location=no,width=610,height=450,toolbar=no,scrollbars=yes");
}

function isEmailValidate(str) {
	if (!isEmail(str.email.value)) {
		alert("Please enter a valid email address.");
		str.focus();
		return false;
		}
	else {
		return true;
		}
}


function isEmail(str) {
  // are regular expressions supported?
  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,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}

//clears email field on focus
var cleared = 0
function clearField(field) {		
	if (cleared != 1) {
		field.value = "";
		cleared=1;}
	else {cleared = 0;}						
}

function windowOpener(winLocation,winName,winSettings) {
   newWindow=window.open(winLocation,winName,winSettings);
}

//Belkin Configurator
function belkinConfigurator(whereitis)
{
	remote = window.open ("","remotewin", "status=yes,toolbar=yes,menubar=no,location=no, resizable=yes, scrollbars=yes, width=800,height=600, top=50,left=200");
	remote.location.href = whereitis;
	if (remote.opener == null)
	{
		remote.opener = window;
	}
	remote.opener.name = "opener";
}