
// 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'){
//if (priceGroupName!='') msgPrices = priceGroupName + ' options' ; 
//if (priceGroupName=='') 
msgPrices = 'product options' ;
document.getElementById('pricesWrapper').style.borderColor='#ff0000';
err=true;
} 

if (document.getElementById('PRODoption').value=='not_selected'){
if (optionsGroupName!='') msgOptions = optionsGroupName + ' ' ;
if (optionsGroupName=='') msgOptions = '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 + '\nPlease select from the ' + 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)}

 
 
 

//main hovers over sub 
Event.observe(window, 'load', function() {
if (browser !="IE5/6") {
var allMains = $$('.PSmainDD');
for (i=0; i < allMains.length; i++) {
var theMainId =  allMains[i].id; 

(function (theMainId) {  
$(theMainId + '_sub').observe('mouseover', function(event) {
Element.addClassName(theMainId, 'mainActive'); 
});
}) (theMainId) ;

(function (theMainId) {  
$(theMainId + '_sub').observe('mouseout', function(event) {
Element.removeClassName(theMainId, 'mainActive'); 
});
}) (theMainId) ;

(function (theMainId) {  
$(theMainId).observe('mouseover', function(event) {
currStatus = $(theMainId).className;
//if (currStyle =='' ) {
//$(theMainId + '_sub').style.display='none';
//$(theMainId + '_sub').style.height='auto';
//new Effect.BlindDown(theMainId + '_sub'  , { duration: 0.2, delay:0.2, queue:'front'} )
//}
});
}) (theMainId) ; 

} //eo loop	
}//not 5/6

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";
}
 
})// eo ready*/

