// JavaScript Document

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}



var as_origin = 'top';
var y = null;
var x = null;


function main() {
;
}


function show_search(as_origin_location) {
		
//		if (document.getElementById('reviewSearch').style.visibility == 'visible' || document.getElementById('wineSearch').style.visibility == 'visible' || document.getElementById('vineyardSearch').style.visibility == 'visible' ) {
//			document.getElementById('reviewSearch').style.visibility = 'hidden';
//			document.getElementById('wineSearch').style.visibility = 'hidden';
//			document.getElementById('vineyardSearch').style.visibility = 'hidden';
//			document.getElementById('advancedSearchClear').style.display = 'block'
//			if (document.getElementById('headlines'))
//				document.getElementById('headlines').style.display = "block";
//
//		}

		if (as_origin == 'top') {
//			document.getElementById('advancedSearch').style.left = document.all.grapefoot_g.x +'px';
//			document.getElementById('advancedSearch').style.top = (document.all.header.clientHeight + 2) + 'px';			
			if (document.getElementById('advancedSearchtop').style.display == 'none') {
//				document.getElementById('advancedSearchClear').style.display = 'none'
				document.getElementById('advancedSearchtop').style.display = 'block';

				document.getElementById('advancedSearchtop').align = 'center';
				
			} else {
				document.getElementById('advancedSearchtop').style.display = 'none';
//				document.getElementById('advancedSearchClear').style.display = 'block'
			}
		}	
}

	

function show_custom(content_name) {
	
	
			if (document.getElementById(content_name).style.display == 'none') {
				document.getElementById(content_name).style.display = 'block';
			} else {
				document.getElementById(content_name).style.display = 'none';
			}
}



function show_hide(target) {
	if (document.getElementById(target).style.display == 'none')
		document.getElementById(target).style.display = 'block';
	else
		document.getElementById(target).style.display = 'none';	
}

function switch_hide(show, hide) {
	if (document.getElementById(show).style.display == 'none') {
		document.getElementById(hide).style.display = 'none';
		document.getElementById(show).style.display = 'block';
	}	
	

}



function show_hide_menu(target) {
	
	var menuItem = new Array();
	menuItem[0] = "apple_computers";
	menuItem[1] = "audio_speakers";
	menuItem[2] = "training";
	menuItem[3] = "accessories";
	menuItem[4] = "bags_protection";
	menuItem[5] = "displays_projectors";
	menuItem[6] = "ipods_iphone";
	menuItem[7] = "networking";
	menuItem[8] = "photo_video";
	menuItem[9] = "printer_scanner";
	menuItem[10] = "storage";
	menuItem[11] = "software";
	menuItem[12] = "minimize";
	menuItem[13] = "splash";
	
	for (i=0;i<menuItem.length;i++) {
		
		if (menuItem[i] == target) {
			if (document.getElementById(target).style.display == 'none') {
				document.getElementById(target).style.display = 'block';
			} else	{
				document.getElementById(target).style.display = 'none';	
			}
		} else {
			if (document.getElementById(menuItem[i]).style.display == 'block') 
				document.getElementById(menuItem[i]).style.display = 'none';
			
			
		}
		
	}
}

		
function header_image() {
	var headerImg = new Array();
	var headerLink = new Array();
	var headerMsg = new Array();
	
	headerImg[0] = "imacs_now_in.png";
	headerLink[0] = "http://sohoservices.com/?p=905";
	headerMsg[0] = "All new iMacs now in-stock at Soho";
	
	headerImg[1] = "gotamac_call.png";
	headerLink[1] = "http://www.sohoservices.com/support/";
	headerMsg[1] = "Got a Mac? Call 250-381-7646";
	
	headerImg[2] = "nightowls_open_24_7.png";
	headerLink[2] = "http://www.sohoservices.com/store.html";
	headerMsg[2] = "Webstore now open!";
	
	headerImg[3] = "ipad1.png";
	headerLink[3] = "http://sohoservices.com/?p=1282";
	headerMsg[3] = "The all new Apple iPad - Learn more";
	
	var staffImg = "intranet.png";
	var staffLink = "http://www.sohoservices.com/";
	var staffMsg = "Log Out!";
	
	var p = headerImg.length;
	var random_selector = Math.round(Math.random()*(p-1));
	
	var locationString = location.href;
	locationString = locationString.toString();
	var testString = locationString.indexOf('store');
	
	var testString2 = locationString.indexOf('staff');
	
	// sticky 

	if ((location.href == 'http://www.sohoservices.com/' ) || (location.href == 'http://sohoservices.com/')) {
		document.write('<table border="0" cellpadding="0" cellspacing="0" width="1100"><tr><td height="150" bgcolor="#FFFFFF">');
		document.write('<a href="' + headerLink[3] + '" onclick="window.close();"><img src="http://www.sohoservices.com/i/headers/' + headerImg[3] + '" border="0" height="150" width="1100" alt="' + headerMsg[3] + '" ></a>');
		document.write('</td></tr></table>');
		
	} else {
	
		if (testString2 >= 0 ){
		
			document.write('<table border="0" cellpadding="0" cellspacing="0" width="1100"><tr><td height="150" bgcolor="#FFFFFF">');
			document.write('<a href="' + staffLink + '" onclick="window.close();"><img src="http://www.sohoservices.com/i/headers/' + staffImg + '" border="0" height="150" width="1100" alt="' + staffMsg + '" ></a>');
			document.write('</td></tr></table>');
		
		} else {
			if (testString >= 0) {
				;
			} else {
				document.write('<table border="0" cellpadding="0" cellspacing="0" width="1100"><tr><td height="150" bgcolor="#FFFFFF">');
				if ((location.href == "http://www.sohoservices.com/") || (location.href == "http://sohoservices.com/")) {
					document.write('<a href="' + headerLink[0] + '"><img src="http://www.sohoservices.com/i/headers/' + headerImg[0] + '" border="0" height="150" width="1100" alt="' + headerMsg[0] + '" ></a>');
				} else if (location.href == "http://sohoservices.com/sandbox/wordpress/?page_id=979") {
					document.write('<a href="' + headerLink[1] + '"><img src="http://www.sohoservices.com/i/headers/' + headerImg[1] + '" border="0" height="150" width="1100" alt="' + headerMsg[1] + '" ></a>');
				
				} else {
					document.write('<a href="' + headerLink[random_selector] + '"><img src="http://www.sohoservices.com/i/headers/' + headerImg[random_selector] + '" border="0" height="150" width="1100" alt="' + headerMsg[random_selector] + '" ></a>');
				}
				document.write('</td></tr></table>');
			}
		}
	}
			
}		



function footer_specials() {
	var offerImg = new Array();
	var offerLink = new Array();
	var offerText = new Array();
	var whichOffer = new Array();
	
	var base_img_url = 'http://www.sohoservices.com/i/footer_feature/';
	var base_link_url = '';
	
	
	offerImg[0] = 'gela_boombox_220.png';
	offerLink[0] = 'http://sohoservices.com/store.html?Bags & Protection/Notebook Skins.html%';
	offerText[0] = 'Gelaskins - decorative covers for 13" Macbook/Air/Pro: $29.99';
	
	offerImg[1] = 'ipod_shuffles_220.png';
	offerLink[1] = 'http://sohoservices.com/store.html?index.php?c=1000022%';
	offerText[1] = 'iPod Shuffles: 2Gb starting at $69.99';
	
	offerImg[2] = 'snow_leopard_220.png';
	offerLink[2] = 'http://sohoservices.com/store.html?MC223Z/A.html%';
	offerText[2] = 'Mac OS X 10.6 Snow Leopard: $35.00';
	
	offerImg[3] = 'applecare220.png';
	offerLink[3] = 'http://sohoservices.com/store.html?index.php?search=applecare%';
	offerText[3] = 'AppleCare Protection Plan';
	
	offerImg[4] = 'samsung_ptr_220.png';
	offerLink[4] = 'http://sohoservices.com/store.html?CLP-310N.html%';
	offerText[4] = 'Samsung CLP-310N Color Laser: $229.99';
	
	offerImg[5] = 'ipod_nano_blue_220.png';
	offerLink[5] = 'http://sohoservices.com/store.html?iPod%20&%20iPhone/iPods/iPod%20Nano.html%';
	offerText[5] = 'iPod nano: 8Gb starting at $169.99';


	offerImg[6] = 'usb_hub4_220.png';
	offerLink[6] = 'http://sohoservices.com/store.html?TRIHUB4.html%';
	offerText[6] = 'MacAlly 4-Port Hub: $39.99';
	
	offerImg[7] = 'ipod_touch_220.png';
	offerLink[7] = 'http://sohoservices.com/store.html?iPod & iPhone/iPods/iPod Touch.html%';
	offerText[7] = 'iPod touch: 8Gb starting at $219.99';
	
	offerImg[8] = 'booq_python_skin_220.png';
	offerLink[8] = 'http://sohoservices.com/store.html?PSKS-DNM.html%';
	offerText[8] = 'booq Python Skin S denim notebook case for 13\" MacBooks and MacBook Pros: $69.99';

	offerImg[9] = 'airport_express_220.png';
	offerLink[9] = 'http://sohoservices.com/store.html?MB321AM/A.html%';
	offerText[9] = 'Apple Airport Express wireless-N base station with USB printer sharing and AirTunes: $109.99';
	
	offerImg[10] = 'airport_extreme_220.png';
	offerLink[10] = 'http://sohoservices.com/store.html?MC340AM/A.html%';
	offerText[10] = 'Apple Airport Extreme wired and wireless-N router with USB printer/hard drive sharing: $199.99';
	

	


	var j = 0;
	var p = offerImg.length;

	whichOffer[0] = 99;
	whichOffer[1] = 99;
	whichOffer[2] = 99;
	whichOffer[3] = 99;
	whichOffer[4] = 99;
	
	
	whichOffer[0] = Math.round(Math.random()*(p-1));
	
while (whichOffer[1] == 99 ) {
	m = Math.round(Math.random()*(p-1))
	if (whichOffer[0] != m)
		whichOffer[1] = m;
	}

while (whichOffer[2] == 99 ) {
	m = Math.round(Math.random()*(p-1));
	if ((whichOffer[0] != m) && (whichOffer[1] != m))
		whichOffer[2] = m;
	}

while (whichOffer[3] == 99 ) {
	m = Math.round(Math.random()*(p-1));
	if ((whichOffer[0] != m) && (whichOffer[1] != m) && (whichOffer[2] != m))
		whichOffer[3] = m;
	}

while (whichOffer[4] == 99 ){
	m = Math.round(Math.random()*(p-1));
	if ((whichOffer[0] != m) && (whichOffer[1] != m) && (whichOffer[2] != m) && (whichOffer[3] != m))
		whichOffer[4] = m;
	}

	var preBuffer = new Array();
	
	for (i = 0; i < p; i++){
  		 preBuffer[i] = new Image()
  		 preBuffer[i].src = offerImg[i]
	}
//	var whichImage = Math.round(Math.random()*(p-1));
	document.write('<div id="footer_specials"><table border="0" cellpadding="10" cellspacing="4" width="1100"><tr>');
	for (k=0; k<5; k++) {
		document.write('<td width="20%" height="200" class="tt0" valign="top" align="left">');
		document.write('<div align="center"><a href="'+base_link_url+offerLink[whichOffer[k]]+'"><img src="'+base_img_url+offerImg[whichOffer[k]]+'" height="150" width="150" border="0"></a></div>');
		document.write('<div><a href="'+base_link_url+offerLink[whichOffer[k]]+'" style="color:#333333">' + offerText[whichOffer[k]] + '</a></div>');
		document.write('</td>');
	};
	document.write('</tr></table></div>');

}



function delineate() {
var str = location.href;

theleft = str.indexOf("?")+1;
theright = str.lastIndexOf("%");
var source_file = str.substring(theleft, theright);
document.write("<iframe width='1100' height='900' frameborder='0' src='http://www.sohoservices.com/store/" + source_file + "' scrolling='auto' id='catalogue' name='catalogue'></iframe>");
}



 
var theObj="";
 
 
function toolTip(text, me) {
  theObj=me;
  theObj.onmousemove=updatePos;
 


  document.getElementById('toolTipBox').innerHTML=text;
  document.getElementById('toolTipBox').style.visibility="visible";

  window.onscroll=updatePos;
}
 
function updatePos() {
  var ev=arguments[0]?arguments[0]:event;
  var xT=ev.clientX;
  var yT=ev.clientY;
  diffX=24;
  diffY=0;
  if ((document.width - xT) < 150) {
	  document.getElementById('toolTipBox').style.top  = yT-2+diffY+document.body.scrollTop+10+ "px";
	  document.getElementById('toolTipBox').style.left = xT-302-diffX-document.body.scrollLeft+"px";
  } else {
      document.getElementById('toolTipBox').style.top  = yT-2+diffY+document.body.scrollTop+10+ "px";
      document.getElementById('toolTipBox').style.left = xT-2+diffX+document.body.scrollLeft+"px";
  }

  theObj.onmouseout=hideMe;
}

function hideMe() {
  document.getElementById('toolTipBox').style.visibility="hidden";
}






// Survey - Entry Pop Window
function soho_win(pop_url) {
	window.open(pop_url, 'soho2win', 'width=400, height=600, left=100, top=50, resizable=no, scrollbars=yes, toolbar=no, location=no, directories=no, status=no, menubar=no, copyhistory=no');

}

function alert_close() {
	if(confirm('Are you sure you want to cancel?\n All entered data will be lost.')) window.close();
}

function serial_win() {
	serial_height = 400;
	serial_width = 950;
	serial_left = ((screen.width/2) - (serial_width/2)) ;
	serial_top = ((screen.height/2) - (serial_height/2));
	serial_win = window.open('http://www.sohoservices.com/forms/serial_location.html', 'serial_location', 'width=' + serial_width + ', height=' + serial_height +  ' , left=' + serial_left + ', top=' + serial_top + ', resizable=no, scrollbars=yes, toolbar=no, location=no, directories=no, status=no, menubar=no, copyhistory=no');
}




function check_win(message, inquiry, page, pic) {
	var generator=window.open('','check_win','height=500,width=350,scrollbars=auto');
  
  generator.document.write('<html><head><title>Inquiry</title>');
  generator.document.write('<link rel="stylesheet" href="soho.css">');
  generator.document.write('</head><body><div style="padding:20px">');
	
  generator.document.write('<p align="center" class="tt3"><img src="' + pic + '"><br />');
  generator.document.write( message + '<br /><b><span  style="color:#999999">' + inquiry + ' </span></b></p>');
  generator.document.write('<form action="inquiry.php" method="post">');
  generator.document.write('<input type="hidden" name="inquiring_about" value="' + inquiry + '"/>');
  generator.document.write('<input type="hidden" name="page" value="' + page + '" />');

  generator.document.write('<p class="tt1">Name: &nbsp;<input type="text" name="name" size="30" maxlength="60" />*<br />');
  generator.document.write('Email: &nbsp;&nbsp;<input type="text" name="email" size="30" maxlength="60" />*<br />');
  generator.document.write('Phone: <input type="text" name="phone" size="14" maxlength="20" />*<br /><span class="tt0">*Required fields</span><br />');
  generator.document.write('<br />Additional Comments:<br /><textarea name="comments" rows="4" cols="36" class="tt1"></textarea></p>');
  generator.document.write('<p align="center"><input type="submit" name="submit" value="Submit" class="tt3" /><input type="button" name="cancel" value="Cancel" onClick="self.close()" class="tt3" /><input type="hidden" name="submitted" value="TRUE" /></p>');      
  
  generator.document.write('</form>');
  generator.document.write('</div></body></html>');
  generator.document.close();
}


function reserve_win(inquiry, page, pic) {
	var generator=window.open('','check_win','height=550,width=350,scrollbars=auto');
  
  generator.document.write('<html><head><title>Reservation Request</title>');
  generator.document.write('<link rel="stylesheet" href="soho.css">');
  generator.document.write('</head><body><div style="padding:20px">');
	
  generator.document.write('<p align="center" class="tt1"><img src="' + pic + '"><br />');
  generator.document.write( 'Request a reservation to be made on: <b><span  style="color:#660000">' + inquiry + ' </span></b>.  A salesperson will contact you as soon as possible with availability and to confirm your request.</p>');
  generator.document.write('<form action="reservation.php" method="post">');
  generator.document.write('<input type="hidden" name="inquiring_about" value="' + inquiry + '"/>');
  generator.document.write('<input type="hidden" name="page" value="' + page + '" />');
  generator.document.write('<input type="hidden" name="to_staff" value="ACTION REQUIRED REQUEST FROM SOHOSERVICES.COM\n\nA REQUEST HAS BEEN MADE TO RESERVE THE PRODUCT BELOW LISTED ON SOHOSERVICES.COM.\nTHIS MESSAGE HAS BEEN SENT TO ALL STAFF.\nIMMEDIATE ACTION IS REQUIRED TO CONTACT THE CUSTOMER AND TO EMAIL ALL STAFF THAT THIS REQUEST HAS BEEN PROCESSED.\n\n\n\n" />');
  generator.document.write('<p class="tt1">Name: &nbsp;<input type="text" name="name" size="30" maxlength="60" />*<br />');
  generator.document.write('Email: &nbsp;&nbsp;<input type="text" name="email" size="30" maxlength="60" />*<br />');
  generator.document.write('Phone: <input type="text" name="phone" size="14" maxlength="20" />*<br /><span class="tt0">*Required fields</span><br />');
  generator.document.write('<br />Additional Comments:<br /><textarea name="comments" rows="4" cols="36" class="tt1"></textarea></p>');
  generator.document.write('<p align="center"><input type="submit" name="submit" value="Submit" class="tt3" /><input type="button" name="cancel" value="Cancel" onClick="self.close()" class="tt3" /><input type="hidden" name="submitted" value="TRUE" /></p>');      
  
  generator.document.write('</form>');
  generator.document.write('</div></body></html>');
  generator.document.close();
}


function subscribe() {
	serial_height = 500;
	serial_width = 600;
	serial_left = ((screen.width/2) - (serial_width/2)) ;
	serial_top = ((screen.height/2) - (serial_height/2));
	serial_win = window.open('http://www.sohoservices.com/forms/serial_location.html', 'serial_location', 'width=' + serial_width + ', height=' + serial_height +  ' , left=' + serial_left + ', top=' + serial_top + ', resizable=yes, scrollbars=auto, toolbar=no, location=no, directories=no, status=no, menubar=no, copyhistory=no');
}

function help_window() {
	serial_height = 600;
	serial_width = 880;
	serial_left = ((screen.width/2) - (serial_width/2)) ;
	serial_top = ((screen.height/2) - (serial_height/2));
	serial_win = window.open('http://www.sohoservices.com/support/index.php', 'Help_Window', 'width=' + serial_width + ', height=' + serial_height +  ' , left=' + serial_left + ', top=' + serial_top + ', resizable=yes, scrollbars=yes, toolbar=no, location=no, directories=no, status=no, menubar=no, copyhistory=no');
}


