
function BadgeReelSel() {
   if ($('bdg_id_1').checked) 
	    $("attrib-25-39").checked = true;
    else if ($('bdg_id_2').checked) 
	    $("attrib-25-40").checked = true;	
	//alert('');
}

function clipArtChange(){
    $('attrib-2-0').value = $('Back_Message').value
	/*$('attrib-9-0').value = $('frontStart').value
	$('attrib-10-0').value = $('frontEnd').value
	$('attrib-12-0').value = $('backEnd').value
	$('attrib-11-0').value = $('backStart').value
	$('attrib-3-0').value = $('Front_Message').value     */
	changeBandMessage();
  //  $("Back_Message").trigger('blur');
}



function clearText() {
     // alert('');
     $('Back_Message').value = "";
     $('attrib-2-0').value = "";
     changeBandMessage();
}




var current_step = 1;
function changeColor(bcolor){

	$('attrib-4-3').value =bcolor;
}
function setStepImg(which){
	/*$('img_step1').src = root + "components/com_virtuemart/shop_image/images/step1.jpg";
	$('img_step2').src = root + "components/com_virtuemart/shop_image/images/step2.jpg";
	$('img_step3').src = root + "components/com_virtuemart/shop_image/images/step3.jpg";
	$('img_step4').src = root + "components/com_virtuemart/shop_image/images/step4.jpg";
	$('img_step5').src = root + "components/com_virtuemart/shop_image/images/step5.jpg";
	
	$('img_step'+which).src = root + "components/com_virtuemart/shop_image/images/step" + which + "_active.jpg"; */
	
	if (which == 1){
		$('backStepImg').style.display = "none";
	}
	else{
		$('backStepImg').style.display = "";
	}
}

function isLastStep(which){
	if (which == 3){
		$('nextstep').style.display = "none";
	}
	else{
		$('nextstep').style.display = "";
	}
		if (which > 1){
		$('back').style.display = "";
	}
	else{
		$('back').style.display = "none";
	}
	$('step'+current_step+'_content').style.display = "";
	
}

function stepClick(which){
	$('step'+current_step+'_content').style.display = "none";
	current_step = which;
	setStepImg(which);
	isLastStep(which);
}

function nextStep(){
	var val = $("lansize").value;
	if (current_step == 1) {
		if (val == "") {
		   alert("Please Select the Lanyard Size!");
		   return 0;
		}
	}
	$('step'+current_step+'_content').style.display = "none";
	current_step++;
	//setStepImg(current_step);
	isLastStep(current_step);
}

function noNext(){
	$('nextstep').style.display = "none";
}


function backStep(){
	$('step'+current_step+'_content').style.display = "none";
	current_step--;
	//setStepImg(current_step);
	isLastStep(current_step);
}
function selectBadge() {

	if ($('badge_id_0').checked) 
	    $("attrib-24-25").checked = true;
    else if ($('badge_id_1').checked) 
	    $("attrib-24-26").checked = true;		
    else if ($('badge_id_2').checked) 
	    $("attrib-24-27").checked = true;
    else if ($('badge_id_3').checked) 
	    $("attrib-24-28").checked = true;
    else if ($('badge_id_4').checked) 
	    $("attrib-24-29").checked = true;		
}

function selectBadgeBlk() {

    if ($('badge_id_0').checked) 
        $("attrib-24-25").checked = true;        
    else if ($('badge_id_2').checked) 
        $("attrib-24-27").checked = true;
    else if ($('badge_id_4').checked) 
        $("attrib-24-29").checked = true;        
}

function selectBadgeSale() {

    if ($('badge_id_1').checked) 
        $("attrib-24-26").checked = true;        
    else if ($('badge_id_2').checked) 
        $("attrib-24-27").checked = true;
    else if ($('badge_id_3').checked) 
        $("attrib-24-28").checked = true;
    else if ($('badge_id_4').checked) 
        $("attrib-24-29").checked = true;    
           // alert('xvcxvxv');         
}


function selectImp() {
   if ($('imp_id_1').checked) 
	    $("attrib-19-18").checked = true;
    else if ($('imp_id_2').checked) 
	    $("attrib-19-19").checked = true;				
	
}

function addToFavorites() 
{ 

var url = 'http://www.customlanyards4all.com';
var title = 'CustomLanyards4all.com';
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);


} 



function selectMsg() {
   if ($('imp_id_1').checked) 
        $("attrib-19-18").checked = true;
    else if ($('imp_id_2').checked) 
        $("attrib-19-19").checked = true;                
}        

function selectAtt() {
    
   if ($('att_id_1').checked) 
	    $("attrib-20-30").checked = true;
    else if ($('att_id_2').checked) 
	    $("attrib-20-31").checked = true;				
    else if ($('att_id_3').checked) 
	    $("attrib-20-32").checked = true;	
    else if ($('att_id_4').checked) 
	    $("attrib-20-33").checked = true;	
    else if ($('att_id_5').checked) 
	    $("attrib-20-34").checked = true;		
    else if ($('att_id_6').checked) 
	    $("attrib-20-35").checked = true;	
    else if ($('att_id_7').checked) 
	    $("attrib-20-36").checked = true;	
    else if ($('att_id_8').checked) 
	    $("attrib-20-37").checked = true;
    else if ($('att_id_9').checked) 
        $("attrib-20-58").checked = true;
    else if ($('att_id_10').checked) 
        $("attrib-20-59").checked = true;       
       // alert('');         			
}

function selectAttSale() {
    
   if ($('att_id_1').checked) 
        $("attrib-20-30").checked = true;              
    else if ($('att_id_3').checked) 
        $("attrib-20-32").checked = true;                              
}

function lanyardColorBlk() {
    if ($('color_1').checked)
        $("attrib-4-0").value = $('color_1').value;  
     else if ($('color_17').checked)
        $("attrib-4-0").value = $('color_17').value; 
     else if ($('color_18').checked)
        $("attrib-4-0").value = $('color_18').value;      
     else if ($('color_9').checked)
        $("attrib-4-0").value = $('color_9').value; 
     else if ($('color_11').checked)
        $("attrib-4-0").value = $('color_11').value;   
         
}


function flanyardColor() {
  if ($('color_1').checked)
        { $("attrib-4-0").value =  "RED";     }
     else if ($('color_2').checked)
        { $("attrib-4-0").value = "BWORN";   }
     else if ($('color_3').checked)
        { $("attrib-4-0").value = "MAROON";  }
     else if ($('color_4').checked)
        { $("attrib-4-0").value = "HOT PINK";  }       
     else if ($('color_5').checked)
        { $("attrib-4-0").value = "PINK";   }
     else if ($('color_6').checked)
        { $("attrib-4-0").value = "ORANGE";  }
     else if ($('color_7').checked)
        { $("attrib-4-0").value = "YELLOW";  }
     else if ($('color_8').checked)
        { $("attrib-4-0").value = "GOLD";  }
     else if ($('color_9').checked)
        { $("attrib-4-0").value = "GREEN";  }
     else if ($('color_10').checked)
        { $("attrib-4-0").value = "DARK GREEN";  }
     else if ($('color_11').checked)
        { $("attrib-4-0").value = "ROYAL BLUE";  }
     else if ($('color_12').checked)
        { $("attrib-4-0").value = "NAVY BLUE";  } 
     else if ($('color_13').checked)
        { $("attrib-4-0").value = "PURPLE";  }
     else if ($('color_14').checked)
        { $("attrib-4-0").value = "LIGHT BLUE";   }      
     else if ($('color_15').checked)
        { $("attrib-4-0").value = "VIOLET";   }
     else if ($('color_16').checked)
        { $("attrib-4-0").value = "GRAY SILVER";   }
     else if ($('color_17').checked)
        { $("attrib-4-0").value ="BLACK";   }
     else if ($('color_18').checked)
        { $("attrib-4-0").value = "WHITE";   }  


    changeBandMessage();		
}

function Ccolorchg() {
	$("attrib-4-0").value = $("customColorName").value;
	changeBandMessage();
}
function customPopup() {
	
	var popupWindow;
	popupWindow = window.open('customcolor.php','name','height=600,width=700, scrollbars=yes');

	/* popupWindow = window.open( 
		'customcolor.php','Custom Color','height=700,width=800,left=10,top=10,resizable=yes,
		scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes');*/
}

 function customSizePopup() {
    
    var popupWindow;
    popupWindow = window.open('index.php?main_page=page_2#lsize','name','height=600,width=700, scrollbars=yes');

    /* popupWindow = window.open( 
        'customcolor.php','Custom Color','height=700,width=800,left=10,top=10,resizable=yes,
        scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes');*/
}

function fcolorChg() {
	//$("attrib-18-0").value = $("fcolor").value;
  var val;
  var  ccolor; 
val = $("fcolor").value;   
if ( val == "pms185") 
  ccolor= "RED";
else if ( val == "pms469" )
  ccolor= "BWORN";
else if ( val == "pms1815" )
  ccolor= "MAROON";
else if ( val == "pms806" )
   ccolor= "HOT PINK";
else if ( val == "pms230")
   ccolor= "PINK";
else if ( val == "pms021")
   ccolor= "ORANGE";
else if ( val == "pms012")
   ccolor= "YELLOW";
else if ( val == "pms123")
   ccolor= "GOLD";
else if ( val == "pms356")
   ccolor= "GREEN";
else if ( val == "pms350")
   ccolor= "DARK GREEN";
else if ( val == "reflex blue")
   ccolor= "ROYAL BLUE";
else if ( val == "pms282")
   ccolor= "NAVY BLUE";
else if ( val == "pms527")
   ccolor= "PURPLE";
else if ( val == "pms305")
  ccolor= "LIGHT BLUE";
else if ( val == "pms2685")
  ccolor= "VIOLET";
else if ( val == "pms421")
   ccolor= "GRAY SILVER";
else if ( val == "black")
  ccolor= "BLACK";
else if ( val == "white")
  ccolor= "WHITE";
$("attrib-18-0").value = ccolor; 
changeBandMessage();
}

function fontChg() {
	$("attrib-5-0").value = $("textfont").value;
    changeBandMessage();
}
function sizeChg() {
	var val = $("lansize").value;
	if ( val == "1" )
	   $("attrib-1-1").checked = true;
	else if ( val == "2" )
	   $("attrib-1-2").checked = true;
	else if ( val == "3")
	   $("attrib-1-17").checked = true;
    else if ( val == "4") 
	   $("attrib-1-38").checked = true;
   else if ( val == "5") 
       $("attrib-1-41").checked = true;   
	//alert(val);
}



function changeBandMessage(){
	 $('attrib-2-0').value = $('Back_Message').value

         
	 var backMessage = $("attrib-2-0").value;
          if ($('Back_Message').value == "" )   
              backMessage= "Lanyard Message Preview";
	 var loading = new Image();
	 var tcolor = $("fcolor").value ;//$("attrib-18-0").value;
     loading.src = "http://customlanyards4all.com/lanyards/images/loading_aqua.gif";		
	 var bgcolor =$("attrib-4-0").value
     var mfont =$("attrib-5-0").value
	 var backImgSrc = new Image();
     //alert(bgcolor);
	 backImgSrc.src = 'addon/phpimage.php?txt=' + backMessage +  '&bcolor=' + bgcolor + '&tcolor=' + tcolor + '&mfont=' + mfont;
		//	var backImgSrc = 'http://24hourwristbands.com/wristbandText.php?msg=zxfzx%20Message&png=white&color=cacaca&side=back&font=Arial';
	 $('backImage').src = loading.src;
	 $('backImage').src = backImgSrc.src;
	

}

