//---------------------------------
// Common Script for site ProPrat
//
//---------------------------------



// --- Common email insertion.

function orderemailaddress(){
  jemail("order","proprat","com");
}

function contactemailaddress(){
  jemail("contact","proprat","com");
}

// --- jemail
function jemail(user, domain, suffix){
  document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">' + user + '@' + domain + '.' + suffix + '</a>');
}  


// --- popUp
// URL path to page to be shown
// xpos == 0 => left = 10, xpos = -1 => Screen center x-wise and wid must not be zero
// ypos == 0 => top = 10, ypos = -1 => Screen center y-wise and hei must not be zero
// wid  == 0 => width = 640, width will always be limited so the total window will be fully visible
// hei  == 0 => height = Desktopheight - 100
// hmax != 0 => height will be limmited to hmax

function popUp(URL,xpos,ypos,wid,hei,hmax) {
  day = new Date();
  id = day.getTime();
  
  pwx = 10;
  if (xpos >= 0)  { pwx=xpos; }
  if (xpos == -1) { pwx=(screen.width/2)-(wid/2); }

  pwy = 10;
  if (ypos >= 0)  { pwy=ypos; }
  if (ypos == -1) { pwy=(screen.height/2)-(hei/2); }

  pww = 640;
  if (wid != 0) { pww=wid; }
  sw = screen.width - 14 - pwx;    
  if (sw < pww) { pww=sw; }
  
  pwh = screen.height - 70 - pwy;
  if (hei  != 0)  { pwh=hei; }
  if (hmax != 0)  { if (pwh > hmax) { pwh=hmax; }}
  
  eval("page" + id + " = window.open(URL, '" + id + "', 'height='+pwh+',left='+pwx+',top='+pwy+',width='+pww+',toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1');");
}

