/*
Digitonal Utility Library
copyright Andrew Dobson 2004
Contains code snippets by Dries Samyn and Natasha Zawawi
*/
function launchMusic(){
window.open("/radioblog/index.php","music","height=323,width=220");
}
function launchGallery(){
window.open("/gallery/gallery.html","gallery","height=395,width=514");	
}
// function for inserting an anti-spider email address
function insertMailLink(name){
at = "@";
domain = "digitonal.com";
document.write("<A href='mailto:" + name + at + domain + "'>" + name +"[@]"+ domain + "</a> (click for mailto link)");
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.mailForm.YMLP0;
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }

function QuickVideo(u,w,h,t){
			//url, firstframe,with,height,target div
			var flashvars = {};
			flashvars.videoSource = u; // the URL of the video
			flashvars.firstFrameSource = "/video/playme.jpg"; // the URL of the "poster frame" jpg/gif/png
			flashvars.autoplay = "true"; // whether or not the video plays automatically - true or false

			var params = {};
			params.bgcolor = "#000000"; // sets the background color of the flash movie.  
			params.allowScriptAccess = "local";
			var attributes = {};
			
			swfobject.embedSWF("/flash/creativeVideo.swf", t, w, h, "9.0.115", "/flash/expressInstall.swf", flashvars, params, attributes);
}

function QuickFlash(u,t,w,h){
	var flashvars = {};
	var params = {};
	var attributes = {};
	swfobject.embedSWF(u, t, w, h, "9.0.115", "/flash/expressInstall.swf", flashvars, params, attributes);
}