
function change(value)
{

if(value=='Biography')
 	{
		page = 'template/site/biography.php';
	}	
	else if(value=='Obituary')
	{
	    page = 'template/site/obituary.php';
	}
	else if(value=='Favorites')
	{
	    page = 'template/site/favorites.php';
	}
	else if(value=='Donate')
	{
	    page = 'template/site/donate.php';
	}
	else if(value=='Candles')
	{
	    page = 'template/site/candles.php';
	}
	else if(value=='Photo')
	{
	    page = 'template/site/photo_gallery.php';
	}
	else if(value=='Timeline')
	{
	    page = 'template/site/timeline.php';
	}
	else if(value=='Badge')
	{
	    page = 'template/site/badge.php';
	}
	else if(value=='Video')
	{
	    page = 'template/site/videogallery.php';
	}	
	else
	{
	  page = 'template/site/body_part.php';
	}
	
	
document.getElementById('_taf').innerHTML = "<table id=\"Table1\" bgcolor=\"#000000\" align=\"center\" border=\"0\" bordercolor=\"#000000\" cellpadding=\"0\" cellspacing=\"0\" height=\"200\" width=\"300\"><tbody><tr><td align=\"center\" bgcolor=\"white\" height=\"100%\"  valign=\"middle\" width=\"100%\"><font color=\"Black\" face=\"Arial\" size=\"4\"><b><br><img src='images/ajax-loader1.gif'/>&nbsp;<br>Loading, please wait...  </strong></font></td></tr></tbody></table>";	

				new Ajax.Updater(
						"_taf", page,
							{
								method: 'post',
								parameters: "id="+value
								});
						
}

function Rotate_Value(id)
{
 	
document.getElementById('_div').innerHTML = "<table id=\"Table1\" bgcolor=\"#000000\" align=\"center\" border=\"0\" bordercolor=\"#000000\" cellpadding=\"0\" cellspacing=\"0\" height=\"200\" width=\"300\"><tbody><tr><td align=\"center\" bgcolor=\"white\" height=\"100%\"  valign=\"middle\" width=\"100%\"><font color=\"Black\" face=\"Arial\" size=\"4\"><b><br><img src='images/ajax-loader1.gif'/>&nbsp;<br>Loading, please wait...  </strong></font></td></tr></tbody></table>";	
	
				new Ajax.Updater(
						"_div", 'template/site/image_rotate.php',
							{
								method: 'post',
								parameters: "id="+id

								});
						
}

function art1(tempvar,id)
{   
    document.getElementById("ali_id").value=id;
	document.getElementById('big_img').src=tempvar;
}

function obiturypopUp(id) {

window.open('template/site/obitury_popup.php?id='+id, '', 'toolbar=0,scrollbars=1,location=0,width=700,height=560,statusbar=0,menubar=0,resizable=1,left = 262,top = 134');
}

function popUp() {
window.open('template/site/popup.php', '', 'toolbar=0,scrollbars=1,location=0,width=700,height=560,statusbar=0,menubar=0,resizable=1,left = 262,top = 134');
}

function HostpopUp() {
window.open('template/site/Hostpopup.php', '', 'toolbar=0,scrollbars=1,location=0,width=700,height=580,statusbar=0,menubar=0,resizable=1,left = 262,top = 134');
}
function FaceBook(url) {
	window.open(url, '', 'toolbar=0,scrollbars=0,location=0,width=550,height=350,statusbar=0,menubar=0,resizable=0,left = 262,top = 134');
}

///////////////validation journal/////////////////////////////////////////////////////

function Vistorpop(id)
{
	window.open('template/site/visitorcontact.php?id='+id, '', 'toolbar=0,scrollbars=1,location=0,width=650,height=450,statusbar=0,menubar=0,resizable=1,left = 262,top = 134');
}

function PhotoVisitor()
{
			if(document.getElementById('fname').value=='')
			{
				alert("Please enter your name");
				document.getElementById('fname').focus(); 
				return false;
			}
			
			if(document.getElementById('photo_email').value=="")
			{
					alert("Please enter your email address");
					document.getElementById('photo_email').focus();
					return false;
			}
			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('photo_email').value))
			
				{
					//return true; 
				}
			
			else
			{
					alert("Please enter valid email address");
					document.getElementById('photo_email').focus();
					return false;
					
			}
		
		if(document.getElementById('title').value=='')
			{
				alert("Please enter photo title");
				document.getElementById('title').focus();
				return false; 
			}
}
function CandleComment()
{
	
	if(document.getElementById("Candlename").value==''){
			alert("Please enter your firstname");
			document.getElementById("Candlename").focus();
			return false;}
	if(document.getElementById("Candlelname").value==''){
			alert("Please enter your lastname");
			document.getElementById("Candlelname").focus();
			return false;}
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('Candleemail').value)){	//return true; 
				}
			else {alert('Please enter valid email address');	document.getElementById('Candleemail').focus(); return false;}

	if(document.getElementById("Candlecomment").value==''){
			alert("Please enter your comment");
			document.getElementById("Candlecomment").focus();
			return false;}		
			
		fname = encodeURIComponent(document.getElementById("Candlename").value);
		lname = encodeURIComponent(document.getElementById("Candlelname").value);
		email = encodeURIComponent(document.getElementById("Candleemail").value);
		comment = encodeURIComponent(document.getElementById("Candlecomment").value);
	
		document.getElementById('display').innerHTML = "<img src='images/ajax-loader1.gif'/>&nbsp;<br><strong>Loading, please wait...</strong>";	
		slideup('ali_display_div');
				new Ajax.Updater(
						"display", 'template/site/commentcandle.php',
							{
								method: 'post',
								parameters: "fname="+fname+"&lname="+lname+"&email="+email+"&comment="+comment
							});
}

/* VIdeo Code*/
function VideoVisitor()
{
	
	if(document.getElementById("title").value==''){
			alert("Please enter video title");
			document.getElementById("title").focus();
			return false;}
		
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('video_email').value)){	//return true; 
				}
			else {alert('Please enter valid email address');	document.getElementById('video_email').focus(); return false;}

	if(document.getElementById("embede").value==''){
			alert("Please enter your video code");
			document.getElementById("embede").focus();
			return false;}		
			
		title = encodeURIComponent(document.getElementById("title").value);
		vemail = encodeURIComponent(document.getElementById("video_email").value);
		video = encodeURIComponent(document.getElementById("embede").value);
	
		document.getElementById('videoID').innerHTML = "<img src='images/ajax-loader1.gif'/>&nbsp;<br><strong>Loading, please wait...</strong>";
		slideup('ali_display_div');
				new Ajax.Updater(
						"videoID", 'template/site/visitorvideo.php',
							{
								method: 'post',
								parameters: "title="+title+"&vemail="+vemail+"&video="+video
							});
}
/**/


function AllowedFormat()
	{
		var msg = "We currently accept the following formats:\n\n";
    	msg += "- JPG\n- GIF\n- PNG\n";
		alert(msg);
	}
	
function checkPhoto(imagePath) 
			{
			var pathLength = imagePath.length;
			var lastDot = imagePath.lastIndexOf(".");
			var fileType = imagePath.substring(lastDot,pathLength);
			
			if((fileType == ".gif") || (fileType == ".jpg") || (fileType == ".png") || (fileType == ".GIF") || (fileType == ".JPG") || (fileType == ".PNG")) 
			{
			return true;
			} 
			else 
			{
			alert("We supports .JPG, .PNG, and .GIF image formats. Your file-type is " + fileType + ".");
			document.getElementById('pic').focus();
			return false;
			}
			}