function FlipAltImage(obj) {
	document.PreviewImage.src=obj.src.replace('/multi/','/medium/');
	if (isNaN(obj.alt)) {
	document.getElementById("alt_image_text").innerHTML=obj.alt;} else {document.getElementById("alt_image_text").innerHTML='&nbsp;'}
	}
function cleanGenericClass(obj,type,class_Name){
//clears all classes for obj id, tagName=type
var x=document.getElementById(obj).getElementsByTagName(type).length;
for (j=0;j<x;j++){
document.getElementById(obj).getElementsByTagName(type)[j].className=class_Name;
}}

function findActiveElement(parentObj,type,class_Name){
//returns active element index
var x=document.getElementById(parentObj).getElementsByTagName(type);
var activeElement;
var ll=x.length;
for (j=0;j<ll;j++){
	if (x[j].className==class_Name) {activeElement=j} 
	}
return 	activeElement;	
}
function makeSelectionAltandChangable(){FlipAltImage(document.getElementById("alt_images").getElementsByTagName("img")[0]);
SelectAlt(document.getElementById("alt_images").getElementsByTagName("img")[0]);
		dropChangeImage();}
		
function AltMouseOut(obj){
	//find active alt image and put it back into frame 
	index=findActiveElement('alt_images','img','act-image-21')
	if (index==0 && document.getElementById("changable-colors" !=null) )
		{//get active element, and preselect item baseod on changable colors selection; first put everything into initial stage, then change color
		makeSelectionAltandChangable();
			}
	else {FlipAltImage(document.getElementById("alt_images").getElementsByTagName("img")[index])}
}

function SelectAlt(obj){
	cleanGenericClass('alt_images','img','inact-image-21');
	obj.className='act-image-21';
	}



function changeImDrop(img) {
cleanGenericClass('changable-colors','img','inact-image');	
//clearClass();
if (document.getElementById("alt_images")!=null) { makeSelectionAltandChangable()}
img.className='act-image';
swapMainImage2(img);
changedropdown(img,'changable-colors');
updatePrice(f1, this);
changeAccesImages();
}
function changeDrop(img)
 {
 cleanGenericClass('non-changable-colors','img','inact-image');
//clearClass();
//preselect alternate images 
if (document.getElementById("alt_images")!=null){
FlipAltImage(document.getElementById("alt_images").getElementsByTagName("img")[0]);
SelectAlt(document.getElementById("alt_images").getElementsByTagName("img")[0]);
}
img.className='act-image';
if (document.getElementById("alt_images")!=null){
document.PreviewImage.src=rememberedImage;
document.getElementById("alt_images").getElementsByTagName("img")[0].className='act-image-21';
}
changedropdown(img,'non-changable-colors');
updatePrice(f1, this);
}

function changeAccesImages(){
	if (document.getElementById("accesories_changable")){
var t=	document.f1.elements["vwattr0_Color"].options[document.f1.elements["vwattr0_Color"].selectedIndex].value
var word=t.substring(0,t.indexOf(" "));
obj=document.getElementById("accesories_changable").getElementsByTagName("img")
for (i=0; i<obj.length;i++){
	obj[i].src=obj[i].src.substring(0,obj[i].src.length-4-word.length)+word+".jpg";
	}
}
}
function changedropdown(po,parentobj){

var x=document.getElementById(parentobj).getElementsByTagName("img");
var ll=x.length;
for (j=0;j<ll;j++){
if (x[j].className=='act-image') {document.forms[0].elements["vwattr0_Color"].selectedIndex = j;	}

	}
}
	
function swapMainImage2(td){
var img2=td.src;
var img3=document.PreviewImage.src
document.PreviewImage.src=img2.replace("multi/","medium/");;
}

function dropChangeImage(){
var image=document.forms[0].elements["vwattr0_Color"].selectedIndex;
cleanGenericClass('changable-colors','img','inact-image');
//clearClass();
img=document.getElementById("changable-colors").getElementsByTagName("img")[image];
document.getElementById("changable-colors").getElementsByTagName("img")[image].className='act-image';
swapMainImage2(img);
updatePrice(f1, this);
changeAccesImages()
}
function dropChangeImClass(parentObj){
var image=document.forms[0].elements["vwattr0_Color"].selectedIndex;
cleanGenericClass('non-changable-colors','img','inact-image');
img=document.getElementById('non-changable-colors').getElementsByTagName("img")[image];
document.getElementById('non-changable-colors').getElementsByTagName("img")[image].className='act-image';
//updatePrice(f1, this);
}
function dropChangeImClass2(){
	dropChangeImClass('non-changable-colors');
	if (document.getElementById("alt_images")!=null){
FlipAltImage(document.getElementById("alt_images").getElementsByTagName("img")[0]);
SelectAlt(document.getElementById("alt_images").getElementsByTagName("img")[0]);
}
	updatePrice(f1, this);
	}
/*function clearClass(){

var x=document.getElementById("changable-colors").getElementsByTagName("img").length;

for (j=0;j<x;j++){

document.getElementById("changable-colors").getElementsByTagName("img")[j].className='inact-image'	

	}
}*/
function swapMainImage(td){
var img=td.getElementsByTagName("img")[0].src;
var word=img.substring(img.lastIndexOf("/")+1, img.length-4);
var img2=document.Preview.src
var path=img2.substring(0,img2.lastIndexOf("-")+1)+word.toUpperCase()+".jpg";
document.Preview.src=path;
}

function additCheckBox(object){

var relatedObj=document.f1.group1;
	for (i=0;i<relatedObj.length;i++)
{
	if ( relatedObj[i].checked)
	{
	document.getElementById("item-numb"+ (i+1)).value=relatedObj[i].value;
			}
			else {
							document.getElementById("item-numb"+ (i+1)).value="";}

	

	}

	updatePriceCheckBox(f1,object)
	}
	
function addit2CheckBox(object){

var relatedObj2=document.f1.group71;
	for (i=0;i<relatedObj2.length;i++)
{
	
if ( relatedObj2[i].checked)
	{
		
	document.getElementById("item-numb7"+ (i+1)).value=relatedObj2[i].value;
			}
			else {document.getElementById("item-numb7"+ (i+1)).value="";}

	

	}

	updatePriceCheckBox(f1,object);

	}	
	
	PositionX = 0;
PositionY = 0;
defaultWidth  = 540;
defaultHeight = 540;
var AutoClose = true;
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=( navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
else close(); 
var optNN2='scrollbars=yes,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY; 
var optIE='scrollbars=yes,width=540,height=540,left='+PositionX+',top='+PositionY;
function popImage3(imageURL,obj){
var text2= obj.name;
var text1 = obj.title.replace("&lt;li&gt;","<li>");
popImage4(imageURL,text1,text2);
}
function popImage4(imageURL,text1,text2){
if (isNN){imgWin=window.open('about:blank','',optNN2);}
if (isIE){imgWin=window.open('1-888-666-1639','',optIE);} 
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('function doTitle(){ document.title="Luxaris Home and Spa Store";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=ffffff scroll="yes" onload="doTitle();self.focus()">') 
else writeln('</head><body bgcolor=ffffff scroll="yes" onload="doTitle();self.focus()">');
writeln('<table width=100% cellspacing=0 cellpadding=0 border = 0 height = 100%><tr><tr><td align=center background=http://www.luxaris.com/luxstores/product_details.jpg style="padding-left:135px;" colspan=2><b>'+text1+'</b></td></tr><tr><td width=250 align = center valign = top style="padding-top:15px; border-left:1px solid red;"><img name="rn" src='+imageURL+' style="display:block"><br><font color=#666666 size=-1>Image displayed may differ from actual product appearance, especially in finish.</font></td><td valign=top style="padding:15px;border-right:1px solid red;"><ul style="font-size:12px; font-family:Arial, Helvetica, sans-serif; border:1px solid #CCCCCC;">'+text2+'</ul></td></tr><tr><td colspan=2 align=center style="border-left:1px solid red; border-right:1px solid red; border-bottom:1px solid red;"><br><a href ="javascript: window.close();"><img border = 0 src = http://www.luxstores.com/images/butt-close.jpg></a> &nbsp; &nbsp; <a href = "javascript: window.print();"><img border = 0 src = http://www.luxstores.com/images/butt-print.jpg></a></td></tr></table></body></html>' ); 
close(); 
};
}


function updatePriceCheckBox(frm,obj)
{
    // ----------for multi option any operation
   updatePrice(frm,obj);
  }


function zoomColor(img){
	imageSource=img.src.replace('/multi/','/medium/');
	popImage(imageSource);
	}