
function jump(urlList) {
	var url = urlList.options[urlList.selectedIndex].value;
		if (url != 0) { window.location.href = url; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function pngFix() {
	if (document.all) {
		var i, a, f;
		for (i=0; (a = document.getElementsByTagName("img")[i]); i++) {
			if (a.className=="png") {
				f = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a.src+"')";
				a.src = "http://www.mightybackup.com/img/pixel.gif";
				a.style.filter = f; }
		}
	}
}

function getWindowHeight() {
	var windowHeight=0;
		if (typeof(window.innerHeight)=='number') {
			windowHeight=window.innerHeight;
		}
		else {
			if (document.documentElement&&document.documentElement.clientHeight) {
				windowHeight=document.documentElement.clientHeight;
			}
			else {
				if (document.body&&document.body.clientHeight) {
					windowHeight=document.body.clientHeight;
				}
			}
		}
	return windowHeight;
}


function setFooter() {
	if (document.getElementById) {
	var windowHeight=getWindowHeight();
		if (windowHeight>0) {
			//alert("Window Height is " + windowHeight);
			var contentHeight=document.getElementById('interfaceWrapper').offsetHeight;
			//alert("Content Height is " + contentHeight);
			var footerElement=document.getElementById('footer');
			var footerHeight=footerElement.offsetHeight;
			//alert("Footer Height is " + footerHeight);
			if (windowHeight-(contentHeight+footerHeight)>=-5) {
				footerElement.style.position='relative';
				footerElement.style.top=(windowHeight-
				(contentHeight+footerHeight))+'px';
					//alert("footerElement.style.top " + (windowHeight-(contentHeight+footerHeight)));
			}
			else {
				footerElement.style.position='static';
			}
		}
	}
}
/* Fixes the PNG Issues with IE6 and set the footer at the browser bottom properly */
window.onload = function() {
  //setFooter();
  pngFix();
}
window.onresize = function() {
  //setFooter();
}

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_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_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 popup(imnam) { 
	window.open(imnam,"pop","directory=no,height=150,width=300,toolbar=no,scrollbars=yes,location=no,resizable=yes"); 
}

function submitMe(){
	 if (testValues()){
		document.myform.action='reminder.asp'; 
		document.myform.submit();
		}
	}
function testValues() {
	obj = document.myform;
	var i=0;
	var text="The following entries are missing or invalid:       \n\n";
	
	if (obj.txtFname.value=="") {
		if (i>0) text+="\n";
		i++;
		text+=" - Your First name";
		}
	
	if (obj.txtLname.value=="") {
		if (i>0) text+="\n";
		i++;
		text+=" - Your Last name";
		}
	if (obj.txtEmail.value=="")
		{
		if (i>0) text+="\n";
		i++;
		text+=" - Your e-mail address";
		}
	else{		
		search = /(^[a-zA-Z0-9\-\_]+(\.[a-zA-Z0-9\-\_]+)*\@[a-zA-Z0-9]+[a-zA-Z0-9\-]*[a-zA-Z0-9]+(\.[a-zA-Z0-9]+[a-zA-Z0-9\-]*[a-zA-Z0-9]+)*\.[a-zA-Z]{2,3}$)/;
		result = search.test(obj.txtEmail.value);
		if (result == false) 
			{
			if (i>0) text+="\n";
			i++;
			text+=" - Your e-mail address is invalid"
	   		}
		}
	/*if (obj.txtState.value=="") {
		if (i>0) text+="\n";
		i++;
		text+=" - State/Province";
		}	*/
	if (obj.txtCity.value=="") {
		if (i>0) text+="\n";
		i++;
		text+=" -(Nearest) City";
		}		
	/*if (obj.txtCountry[obj.txtCountry.selectedIndex].value=="") {
		if (i>0) text+="\n";
		i++;
		text+=" - Country";
		}*/
	/*if (obj.txtCountry.value=="") {
		if (i>0) text+="\n";
		i++;
		text+=" - Country";
		}	*/
	if (obj.txtSkill.value=="") {
		if (i>0) text+="\n";
		i++;
		text+=" - Skill";
		}
					
	if (i>0) {
		alert(text);
		return false;
		}
	else {
		return true;
		}
}	

function sendMe(){
	 if (testEcardValues()){
		document.myform.action='process.asp'; 
		document.myform.submit();
		}
	}
function preview(){
	if (testEcardValues()){
		document.myform.action='preview.asp'; 
		document.myform.submit();
		}
	}
	
function testEcardValues() {
	obj = document.myform;
	var i=0;
	var text="The following entries are missing:       \n\n";
	if (obj.fr_email.value=="")
		{
		if (i>0) text+="\n";
		i++;
		text+=" - Your friendīs e-mail address";
		}
	else{		
		search = /(^[a-zA-Z0-9\-\_]+(\.[a-zA-Z0-9\-\_]+)*\@[a-zA-Z0-9]+[a-zA-Z0-9\-]*[a-zA-Z0-9]+(\.[a-zA-Z0-9]+[a-zA-Z0-9\-]*[a-zA-Z0-9]+)*\.[a-zA-Z]{2,3}$)/;
		result = search.test(obj.fr_email.value);
		if (result == false) 
			{
			if (i>0) text+="\n";
			i++;
			text+=" - Your friendīs e-mail address is invalid"
	   		}
		}
	
	if (obj.fr_f_name.value=="") {
		if (i>0) text+="\n";
		i++;
		text+=" - Your friendīs name";
		}
	if (obj.ur_f_name.value=="") {
		if (i>0) text+="\n";
		i++;
		text+=" - Your name";
		}
	if (obj.ur_Email.value=="")
		{
		if (i>0) text+="\n";
		i++;
		text+=" - Your e-mail address";
		}
	else{		
		search = /(^[a-zA-Z0-9\-\_]+(\.[a-zA-Z0-9\-\_]+)*\@[a-zA-Z0-9]+[a-zA-Z0-9\-]*[a-zA-Z0-9]+(\.[a-zA-Z0-9]+[a-zA-Z0-9\-]*[a-zA-Z0-9]+)*\.[a-zA-Z]{2,3}$)/;
		result = search.test(obj.ur_Email.value);
		if (result == false) 
			{
			if (i>0) text+="\n";
			i++;
			text+=" - Your e-mail address is invalid"
	   		}
		}
	if (obj.txtMsg.value=="") {
		if (i>0) text+="\n";
		i++;
		text+=" - Message.";
		}
	else{if (obj.txtMsg.value.length > 2000){if (i>0) text+="\n";i++;text+=" - Message can not be more than 2000 characters.";}}	
	if (obj.n.value=="") {
		if (i>0) text+="\n";
		i++;
		text+=" - Please select a card";
		}					
	if (i>0) {
		alert(text);
		return false;
		}
	else {
		return true;
		}
	}


