var _current=null;
function imgreg(obj,idx,mod){
	if((typeof(obj)=="object")&&(obj.tagName=="IMG")){
		if((typeof(_variants)=="object")&&(typeof(_variants[idx])=="object")){
			obj._variant=_variants[idx];
			obj.onclick=function(e){
				document.images["pimg"].src=this.src.replace(/\/40\.jpg/g,"/240.jpg");
				document.mycard.elements["no"].value=this._variant["pdv_number"];
				var vars=new Array();
				_current=this._variant;
				for(var key in this._variant){
					var itm=swoop.getObjById(key);
					if((itm!=null)&&(typeof(itm)=="object")&&(itm.tagName=="DIV")){
						itm.innerHTML=this._variant[key];}}
				drawval(parseInt(this._variant["pdv_packunit"]));}}}
	if(mod){obj.onclick();}}
function getajaxobj(){
	var obj=null;
	try{obj=new XMLHttpRequest();}
	catch(e){try{obj=new ActiveXObject("Msxml2.XMLHTTP");}
		catch(e){try{obj=new ActiveXObject("Microsoft.XMLHTTP");}
			catch(e){}}}
	return obj;}
function ajaxrequest(url,func,vars){
	try{var http=getajaxobj();
		if((http!=null)&&(typeof(http)=="object")){
			http.open("POST",url,true);
			http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			http.onreadystatechange=function(){
				if((http.readyState==4)&&(http.status==200)){
					if(http.responseText){
						try{func(http.responseText);}catch(e){}}}}
			http.send(vars);}}catch(e){}}
function recalculate(){
	try{if((_current!=null)&&(typeof(_current)=="object")){
			var vbx=swoop.getObjById("valbx");
			if((vbx!=null)&&(typeof(vbx)=="object")&&(vbx.tagName=="SELECT")){
				ajaxrequest(swoop_cnf.html+"content/html/responder/pricefinder.html",function(price){var pbx=swoop.getObjById("pricebox");if((pbx!=null)&&(typeof(pbx)=="object")&&(pbx.tagName=="DIV")){pbx.innerHTML=price;}},"id="+escape(_current["id"])+"&val="+parseInt(vbx.options[vbx.selectedIndex].value));}}}
	catch(e){}}
function newstog(itm,mod,evt){
	try{var prt=swoop.getObjById("ntg");
		if((prt!=null)&&(typeof(prt)=="object")&&(prt.tagName=="DIV")){
			if(typeof(document.images["nwstogimg"])=="object"){
				if(mod){if((evt!=null)&&(typeof(evt)=="object")&&(evt.tagName=="DIV")){try{document.images["nwstogimg"].src=evt.style.backgroundImage.replace(/\/40\//g,"/170/").replace(/^url\("([^)]+)"\)$/g,"$1");}catch(e){}}
					prt.className=itm;}
				else{document.images["nwstogimg"].src=swoop_cnf.html+"content/pictures/tpl/null.gif";
					prt.className=null;}}}}
	catch(e){}}
function drawval(unit){
	try{var vbx=swoop.getObjById("valbx");
		if((vbx!=null)&&(typeof(vbx)=="object")&&(vbx.tagName=="SELECT")){
			for(var i=(vbx.options.length-1);i>=0;i--){
				vbx.options[i]=null;}
			for(var i=0;i<100;i++){
				vbx.options[i]=new Option(((i+1)*unit),((i+1)*unit));}}
		recalculate();}
	catch(e){}}
function setvari(idx,unit){
	try{drawval(unit);
		_current={"id":idx};
		recalculate();}
	catch(e){}}
function popup(){
	pwin=window.open(swoop_cnf.html+"content/html/service/ccinfo.html", "pwin", "height=550,width=450,top=0,left=0,status=1,scrollbars=1,resizable=1");
	pwin.focus();}