///////////////////////////////////////////////////////////////////////////////////////////////////////////////
function load_image(imagename)
{
	//var imagepath='admin/image/'+imagename;
	var image_src="<img src='"+imagename+"' width='300' height='200' border='0'/>";
	document.getElementById('div_imagedisplay').style.display='block';
	document.getElementById('div_imagedisplay').innerHTML=image_src;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function openmyimage(imagename){
		//Define arbitrary function to run desired DHTML Window widget codes
ajaxwin=dhtmlwindow.open("ajaxbox", "ajax", "view_image.php?imagename="+imagename, "View Image", "width=700px,height=500px,left=250px,top=50px,resize=0,scrolling=1")
ajaxwin.onclose=function(){} //Run custom code when window is about to be closed
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
function load_readersimage(imagename)
{
	var imagepath='admin/readers_img/'+imagename;
	var image_src="<img src='"+imagepath+"' width='300' height='200' border='0'/>";
	document.getElementById('div_imagedisplay').innerHTML=image_src;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
function load_musicimage(imagename)
{
	var imagepath='admin/musicreviews/'+imagename;
	//var image_src="<img src='"+imagepath+"' width='300' height='200' border='0'/>";
	//document.getElementById('div_imagedisplay').innerHTML=image_src;
	ajaxwin=dhtmlwindow.open("ajaxbox", "ajax", "view_image.php?imagename="+imagepath, "View Image", "width=700px,height=500px,left=250px,top=50px,resize=0,scrolling=1")
ajaxwin.onclose=function(){} //Run custom code when window is about to be closed

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 insert_comments(userid,password)
{
	//alert(userid);
	//alert(password);
	if(userid && password)
	{
		var comments =document.getElementById('comments').value;
		var email =document.getElementById('email').value;
		if(comments == '')
		{
			alert("Please enter your Comments");
			return false;
		}
		else if((email==null)||(email==""))
		{
			alert("Please Enter your Email ID")
			document.getElementById('email').focus()
			return false
		}
		else if(echeck(email)==false)
		{
			email=""
			document.getElementById('email').focus()
			return false
		}
		else
		{
			document.form1.submit();
		}
	}
	else
	{
		alert("Please logged in to submit comments");
		location.href='member.php';
	}
	
	
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function post_qa(userid,password)
{
	//alert(userid);
	//alert(password);
	if(userid && password)
	{
		var comments =document.getElementById('comments').value;
		if(comments == '')
		{
			alert("Please post your Questions");
			return false;
		}
		
		else
		{
			document.form1.submit();
		}
	}
	else
	{
		alert("Please logged in to post questions");
		location.href='member.php';
	}
	
	
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function post_events(userid,password)
{
	//alert(userid);
	//alert(password);
	if(userid && password)
	{
		var comments =document.getElementById('comments').value;
		var eventstitle =document.getElementById('event_title').value;
		if(eventstitle == '')
		{
			alert("Please enter Events Title");
			return false;
		}
		if(comments == '')
		{
			alert("Please post your Comments");
			return false;
		}
		
		else
		{
			document.form1.submit();
		}
	}
	else
	{
		alert("Please logged in as a Member!");
		location.href='member.php';
	}
	
	
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

