// v3.js (c) 2006, asknet AG (rwm)
// JavaScript Basics for V3
// Version 1.0.06.12.14
// 1.0.06.12.14 rwm read sysLocation, cleaned js syntax
// 1.0.06.11.13 rwm added popup_special, declared img_old
// 1.0.06.10.12 ms added change_img
// 1.0.06.09.01 rwm initial version

var img_old;

function jumpMenu(type,newVal,isSelect,doHide) // v1.1
{
  var text = [ 0, "/ml=", "/curr=", "/reg=" ];
  var val = isSelect ? newVal.options[newVal.selectedIndex].value : newVal;
	if ( val === "" ) { return; }
	
  var sea = document.location.search;
  var pat = document.location.pathname.replace(/%3D/,"=");
  var pos = 99999;
	var red = '';
	if ( typeof sysLocation !== 'undefined' ) {
		if ( pat.search(sysLocation) == -1 )  { red = sysLocation; }
	}
  if ( red ) {
		document.location.href = red + text[type] + val;
	}
	else {
		if (pat.search('cgi-bin/cart') != -1) { sea = ""; } 
  	for ( var i=1; i < 4; i++ ) {
  	  pos = pat.lastIndexOf(text[i]) > 0 ? Math.min(pat.lastIndexOf(text[i]),pos) : pos;
  	}
  	if (pos == 99999 ) {
  		document.location.href = pat + text[type] + val + sea;
  	}
  	else {
			document.location.href = pat.substr(0,pos) + text[type] + val + sea;
		}
	}
  if ( doHide ) { newVal.selectedIndex=0; }
}

function updateMenu(name, curVal) {
  for ( var i=0; i < name.length; i++) {
		if ( name.options[i].value == curVal ) { name.selectedIndex = i; }
	}
}

function popupwin(url,win,x,y,m) { // v1.2
  x = x === null ? 450 : x;
  y = y === null ? 600 : y;
  m = m === null ? "no" : m;
  popup=window.open(url,win,"width="+x+",height="+y+",resizable=yes,scrollbars=yes,menubar="+m);
  popup.focus();
}

function popup_special(url,type) {
  var x,y,m,win;
  switch (type) {
    case 'pinfo':
      x = 400; y = 120; m='no'; win='Info';
      break;
    case 'vatinfo':
      x = 500; y = 250; m='no'; win='Info';
      break;
    case 'shippinginfo':
      x = 500; y = 300; m='no'; win='Info';
      break;
    default:
      x = 450; y = 600; m='no'; win='Info';
      break;
  }
  popupwin(url,win,x,y,m);
}

function change_img(img,obj){
  if(img=="old"){ obj.src=img_old;}else{img_old=obj.src;obj.src=img; }
}