function searchboxClick(inputID){
	document.getElementById(inputID).value="";
	document.getElementById(inputID).style.color="#252525";
}

function searchboxClickout(inputID) {
	document.getElementById(inputID).style.color="#A0A0A0";
}

function inputClickIn(inputID){
	document.getElementById(inputID).value="";
	document.getElementById(inputID).style.color="#252525";
}

function inputClickOut(inputID) {
	document.getElementById(inputID).style.color="#A0A0A0";
}


function showHide(id,action)
{
	obj = document.getElementById(id);
	if (!action) action = "show";
	if (action=="show") obj.style.display="";
	else if (action=="hide") obj.style.display="none";
}



// stuff for iframe, device selection and phone.php 

function loadFrame(select_type,value,dtype,pop,product) {
	if (value == '------------------------------') return false;
	document.getElementById('phones').innerHTML = '<br /><img src="/images/icon-wait.gif" /> <br /><br /><br /><br /><br /><br /><br />';
	var strURL;
	var carrier_uid = 0;
	var manufacturer = "";
	var os = "";
	if (select_type == 'carrier') {
		carrier_uid = value;
		document.getElementById('manufacturer').selectedIndex = 0;
	}
	else if (select_type == 'manufacturer') {
		manufacturer = value;
		// removing since I am removing the carrier selection.  -PB, 2/2006
		//document.getElementById('carrier_uid').selectedIndex = 0;
	}
	else if (select_type == 'os') {
	//alert('os');
		os = value;
		// removing since I am removing the carrier selection.  -PB, 2/2006
		//document.getElementById('carrier_uid').selectedIndex = 0;
		if (os != "BlackBerry") document.getElementById('manufacturer').selectedIndex = 0;
	}
	
	// this line will determine how showdevices.php will query for devices
	strURL = '../showdevices.php?cuid='+carrier_uid+'&manf='+manufacturer+'&os='+os+'&dtype='+dtype+'&pop='+pop+'&product='+product;
	
	if (value == 'seePhone')
	{
		window.location = 'phones.php?dtype=phone';
	}
	if (value == 'seePDA')
	{
		window.location = 'phones.php?dtype=pda';
	}
	
	if ((value != 'seePDA') && (value != 'seePhone'))
	{
		if (document.frames) {
			document.frames('loadphones').location.replace(strURL);
		}
		else {
			window.frames['loadphones'].location.replace(strURL);
		}
	}
}


function iFrame2Div() {
        div = parent.document.getElementById('phones');
        frameDiv = parent.window.frames['loadphones'].document.getElementById('devices');
        html = frameDiv.innerHTML;
        div.innerHTML = '';
        div.innerHTML = html;
}


/*function loadFrame(sel,type) {
	document.getElementById('phones').innerHTML = '<br>Loading...';
	if (sel=="AT") sel="AT&amp;T WS";
	var strURL;
	 if (sel != "") {
		if (document.frames) {
			strURL = '../products/showdevices.php?m='+sel+'&type='+type;
			document.frames('loadphones').location.replace(strURL);
		}
		else {
			strURL = '../products/showdevices.php?m='+sel+'&type='+type;
			window.frames['loadphones'].location.replace(strURL);
		}
	 }
	 document.getElementById('deviceMan').value = sel;
	 
	 /*if (type == "carrier")
	 {
		selInd = sel.split("!");
		document.getElementById('deviceMan').value = selInd[0];
	 }*/
/*}*/


function chooseMan(sel,dtype) {
	//window.location = "/products/phones.php?manf="+sel+"&dtype="+dtype;
	window.location = "phones.php?manf="+sel+"&dtype="+dtype;
}

function parentWin(url)
{
	window.opener.location.href = url;
	window.close();
}


//shopping cart functions

function validate_device()
{
	if ((document.check_device.device.selectedIndex == 0) & (document.check_device.skip.checked != true ))
	{
		alert("Please select a device from the list");
		document.check_device.device.focus();
		return false;
	}
	return true;
}




function popup(url, windowname)
{
if (! window.focus)return true;
window.open(url, "handmarkstorehelp", 'width=400,height=600,scrollbars=1');
}

function popupVerisign(url) 
{
sealWin = window.open(url,"win",'toolbar=0,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=550,height=450');
self.name = "mainWin";
}

function popVerisign(url) {
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=600,height=450');
	self.name = "parentWindow";
}



// splash image swap
 var aryImages = new Array(20);

  aryImages[189] = "/assets/site_images/splash/device189.jpg";
  aryImages[244] = "/assets/site_images/splash/device244.jpg";
  aryImages[257] = "/assets/site_images/splash/device257.jpg";
  aryImages[292] = "/assets/site_images/splash/device292.jpg";
  aryImages[300] = "/assets/site_images/splash/device300.jpg";
  aryImages[307] = "/assets/site_images/splash/device307.jpg";
  aryImages[308] = "/assets/site_images/splash/device308.jpg";
  aryImages[345] = "/assets/site_images/splash/device345.jpg";  
  aryImages[350] = "/assets/site_images/splash/device350.jpg";
  aryImages[359] = "/assets/site_images/splash/device359.jpg";
  aryImages[360] = "/assets/site_images/splash/device360.jpg";
  aryImages[364] = "/assets/site_images/splash/device364.jpg";
  aryImages[372] = "/assets/site_images/splash/device372.jpg";
  aryImages[374] = "/assets/site_images/splash/device374.jpg";
  aryImages[376] = "/assets/site_images/splash/device376.jpg";
  aryImages[420] = "/assets/site_images/splash/device420.jpg";
  aryImages[467] = "/assets/site_images/splash/device467.jpg";
  aryImages[469] = "/assets/site_images/splash/device469.jpg";
  aryImages[476] = "/assets/site_images/splash/device476.jpg";
  aryImages[478] = "/assets/site_images/splash/device478.jpg";
  aryImages[479] = "/assets/site_images/splash/device479.jpg";
  aryImages[480] = "/assets/site_images/splash/device480.jpg";
  aryImages[484] = "/assets/site_images/splash/device484.jpg";
  aryImages[486] = "/assets/site_images/splash/device486.jpg";
  aryImages[505] = "/assets/site_images/splash/device505.jpg";
  aryImages[560] = "/assets/site_images/splash/device560.jpg";
  aryImages[566] = "/assets/site_images/splash/device566.jpg";
  aryImages[574] = "/assets/site_images/splash/device574.jpg";
  aryImages[620] = "/assets/site_images/splash/device620.jpg";
  aryImages[653] = "/assets/site_images/splash/device653.jpg";
  aryImages[654] = "/assets/site_images/splash/device654.jpg";
  aryImages[668] = "/assets/site_images/splash/device668.jpg";
  aryImages[695] = "/assets/site_images/splash/device695.jpg";
  aryImages[728] = "/assets/site_images/splash/device728.jpg";
  aryImages[727] = "/assets/site_images/splash/device727.jpg";
  aryImages[724] = "/assets/site_images/splash/device724.jpg";
  aryImages[726] = "/assets/site_images/splash/device726.jpg";
  aryImages[769] = "/assets/site_images/splash/device769.jpg";





// preload, but takes too long to download all those images
//  for (i=0; i < aryImages.length; i++) {
//    var preload = new Image();
//    preload.src = aryImages[i];
//  }

  function swap(imgIndex) {
    document['splash-image'].src = aryImages[imgIndex];
  }

