// Swaps 2 images in Re-oreder module
var downID='';
var upID='';

function drag(FromID) 
{
	downID=FromID;
}
function drop(ToID) 
{
	upID=ToID;
	if(downID!='') swap(downID,upID);
}
function swap(FromID,ToID) 
{
	from_obj=document.getElementById("obj_"+FromID);
	to_obj=document.getElementById("obj_"+ToID);
	hid_from=document.getElementById("hid_"+FromID);
	hid_to=document.getElementById("hid_"+ToID);
	from_obj.src = eval("img_"+hid_to.value + ".src")
	to_obj.src = eval("img_"+hid_from.value + ".src")
	tmp=hid_from.value;
	hid_from.value=hid_to.value;
	hid_to.value=tmp;

	alt_from=document.getElementById("alt_"+FromID);
	alt_to=document.getElementById("alt_"+ToID);
	tmp=alt_from.value;
	alt_from.value=alt_to.value;
	alt_to.value=tmp;

	if (document.getElementById("comments_"+FromID)) {
		comments_from=document.getElementById("comments_"+FromID);
		comments_to=document.getElementById("comments_"+ToID);
		tmp=comments_from.value;
		comments_from.value=comments_to.value;
		comments_to.value=tmp;
	}

	id_from=document.getElementById("img_id_"+FromID);
	id_to=document.getElementById("img_id_"+ToID);
	tmp=id_from.value;
	id_from.value=id_to.value;
	id_to.value=tmp;
	
	upID='';
	downID='';	
}

function dpSmartLink(u,n,w,h,p) { // v1.4
  var a,j,k,x,y,f='',ref='';
  ref=window.location.href;
  if(!n){n='';}
  if(w){f+='width='+w+',';}
  if(h){f+='height='+h+',';}
  if(p)
  {
    p=p.split(':');
    if(p[0]!='z'){p[0]=='c'?(x=(screen.width-w)/2):x=p[0];f+='left='+x+',';}
    if(p[1]!='z')
    {
      if(p[0]=='c')
      {
        y=(screen.height-h-p[1])/2;
        if(navigator.appName.indexOf('Op')!=-1)
        {
          y-=96;y=y<0?0:y;
        }
      }
      else
      {
        y=p[1];
      }
      f+='top='+y+',';
    }
  }
  a=arguments.length;
  if(a>5)
  {
    for (k=5;k<a;k++)
    {
      switch(arguments[k])
      {
        case 'all':f+='toolbar,menubar,location,scrollbars,status,resizable,';break;
        case 't':f+='toolbar,';break; 
        case 'm':f+='menubar,';break;
        case 'l':f+='location,';break;
        case 'sc':f+='scrollbars,';break;
        case 's':f+='status,';break;
        case 'r':f+='resizable,';
      }
    }
  }
  if(f.charAt(f.length-1)==',')
  {
    f=f.slice(0,-1);
  }
  j=window.open(u+'?ref='+escape(ref),n,f);j.focus();
  document.MM_returnValue=false;
}
function isEmail(who) {
	if (who.value='') return true;
	var email=/^[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/i;
	return(email.test(who));
}

