// MSERG ---------------
function checkFld(f,c) {
	if(f.value=="" || f.value==" "){
		alert("Value in "+c+" is a must!");
		return false;
	} else return true;
}

function fullScreen() {
	var w=screen.width, h=screen.height; //alert(w+'x'+h);
	var extra=0;
	if(navigator.userAgent.indexOf("MSIE")>=0) extra=4;
	if(w>=640 && h>=480) { moveTo(0-extra,0-extra); resizeTo(w+2*extra,h-20);}
}

function bookMark() {
  if (navigator.userAgent.indexOf('MSIE')>=0)
    window.external.addFavorite(document.location.href, "ASA Vantage Romantic Adventures");
  else
    alert('To bookmark a web page:\n\n1. Go to the web page you want to bookmark.\n\n2. Click Bookmarks. On Mac OS, open the Bookmarks\nmenu--the green bookmark icon to the right of the Go menu.\n\n3. Choose Add Bookmark.');
  return false;
}

// âûâåñòè ññûëêó mailto ñî ñêðûòûì ìåéëîì 
function hiddenEmail(u,h,t) {
	var m;
	m=u+'@'+h; if(!t) t=m;
	document.write('<a href="mailto:'+m+'">'+t+'</a>');
}
// MSERG ---------------

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function placeHolderPopup(string) {
  alert('Go to:' + string);
  return false;
}

function swapDisplay(thisname) {
//alert('swapping...');
//if(window.opera) return;
  if(document.getElementById) element=document.getElementById(thisname);
  else if(document.all) element=document.all[thisname];
  if(element.style.display=="none") element.style.display="";
  else element.style.display="none";
}

function showDateBox(thisbox, thisvalue) {
//if(window.opera) return;
  if(document.getElementById)
    element=document.getElementById(thisbox);
  else if(document.all)
    element=document.all[thisbox];

	if (thisvalue == "unavailable")
		element.style.display = "";
	else
		element.style.display = "none";	
	
}

function MM_openBrWindow(url,target,W,H) { //v2.0

   var X = (screen.width/2)-(W/2);
   var Y = (screen.height/2)-(H/2);

   var winPref = "width=" + W + ",height=" + H
               + ",innerWidth=" + W + ",innerHeight=" + H
               + ",left=" + X + ",top=" + Y
               + ",screenX=" + X + ",screenY=" + Y
               + ",dependent=yes,titlebar=no,scrollbars=no,resizable=no";

   window.open( url, target, winPref );
}

function displayErrors(jsErrorStr) {
  if(jsErrorStr.length) {
    alert(jsErrorStr);
  }
}

function flipInactive(objCheckbox) {
  if(objCheckbox.checked == true) {
    document.getElementById('inactiveUntilDateSpan').style.display = 'inline';
  } else {
    document.getElementById('inactiveUntilDateSpan').style.display = 'none';
  }
}

function joinPopUp() {
  alert('For Members Only');
}

function openMsg(messageId, messageStatus, amount)
{
	if (messageStatus == 'new') {
		if( window.confirm("This will deduct "+amount+" pounds from your account.") ) {
			document.viewMsgForm.messageID.value = messageId;
			document.viewMsgForm.submit();
		}
	} else {
		document.viewMsgForm.messageID.value = messageId;
		document.viewMsgForm.submit();	
	}
}

function printClient()
{
	window.print();
	document.printclientform.submit();		
}

var ru2tr = { // thanks to http://forum.dklab.ru/viewtopic.php?p=183135
  ru_str : "ÀÁÂÃÄÅ¨ÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäå¸æçèéêëìíîïðñòóôõö÷øùúûüýþÿ",
  en_str : ['A','B','V','G','D','E','JO','ZH','Z','I','J','K','L','M','N','O','P','R','S','T',
    'U','F','H','C','CH','SH','SHH',String.fromCharCode(35),'I',String.fromCharCode(39),'JE','JU',
    'JA','a','b','v','g','d','e','jo','zh','z','i','j','k','l','m','n','o','p','r','s','t','u','f',
    'h','c','ch','sh','shh',String.fromCharCode(35),'i',String.fromCharCode(39),'je','ju','ja'],
  translit : function(org_str) {
    var tmp_str=[];
    for(var i=0, l=org_str.length; i<l; i++) {
      var s=org_str.charAt(i), n=this.ru_str.indexOf(s);
      if(n>=0) tmp_str[tmp_str.length]=this.en_str[n];
      else tmp_str[tmp_str.length]=s;
    }
    return tmp_str.join("");
  }
}// trstring = ru2tr.translit('string');

