
// buy check
validatePurchase = function (priceGroupName,optionsGroupName) { // passed if exist for options on buy button
var msgOptions='';
var msgPrices='';
var msg='';
var err=false;
if (document.getElementById('priceSelector').value=='not_selected'){
msgPrices =  priceGroupName + ' Options ' ; //Pricing
document.getElementById('pricesWrapper').style.borderColor='#ff0000';
err=true;
} 

if (document.getElementById('PRODoption').value=='not_selected'){
msgOptions = optionsGroupName + ' Options ' ;
document.getElementById('optionsWrapper').style.borderColor='#ff0000';
err=true;
} 



if (err){
if (msgPrices  !='' && msgOptions =='') msg = 'Please select from the ' + msgPrices ; //prices only
if (msgOptions !='' && msgPrices  =='') msg = 'Please select from the ' + msgOptions ; //options only
if (msgPrices  !='' && msgOptions !='') msg = 'Please select from the ' + msgPrices + ' and ' + msgOptions ; //both
alert(msg);
return false;
}
} 
// buy check



//images  
var currentImage=1;
var currentArrayPosition=1;
function showLargeImage(id){
win=window.open('/product-images/' + id + '/' + currentArrayPosition	 + '.htm','details','width=300,height=100');
win.focus();
}

function swapImage(picNum,arrayPosition){
currentImage=picNum;
currentArrayPosition=arrayPosition; // used to open correct in array
theId=$('idForMedia').value;  //hdn on P_D page for id selected
$('detailsImage').src='xthumbs2/' + theId + '/'+ picNum + '.jpg'; 
}
//images


//  back to  images
function showImages(){
$('imagesWrapper').style.display='block';
$('vidWrapper').innerHTML='&nbsp;'; //empty container collapses FF
$('vidWrapper').style.display='none';

$('vidButton').style.display='block';
$('imagesButton').style.display='none';
} 

function showVideo(vidNum){
$('imagesWrapper').style.display='none';
$('vidWrapper').style.display='block';

$('vidButton').style.display='none';
$('imagesButton').style.display='block';
 
theId=$('idForMedia').value; //hdn on P_D page for id selected
//new Effect.Opacity( 'mediaWrapper',  {duration:0.8, from:0, to:1.0} ); 
new Ajax.Updater('vidWrapper','media/_detailsVideo.inc.php?id='+theId+'&vidNum='+vidNum ,{
evalScripts:true
})  
} 

 


//hovers and zooms
var showDetailTimer;
function hideDetailLayers(){
//clearTimeout(showDetailTimer);
$('productDetailsInfo').style.visibility='hidden';
$('linkedItems').style.visibility='hidden'
}

function showDetailLayers(){
$('productDetailsInfo').style.visibility='visible';
$('linkedItems').style.visibility='visible'
}

 



function pageTop(){scroll(0,0)}

 

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

