function chklogin()
{
	var username =  document.getElementById('username').value;
	
	var password =  document.getElementById('password').value;
	if(username=="")
	{
		alert("Please Enter the Username");
		document.getElementById('username').focus();
		return false;
	}
	if(password=="")
	{
		alert("Please Enter the Password");
		document.getElementById('password').focus();
		return false;
	}
}
function submitaction()
{
	
	var password =  document.getElementById('password').value;
	
	var conpassword =  document.getElementById('conpassword').value;
	if(password=="")
	{
		alert("Please Enter the Password");
		document.getElementById('password').focus();
		return false;
	}
	else
	if(password!=conpassword)
	{
		alert("Password Mismatch");
		document.getElementById('password').focus();
		return false;
	}
	var email =  document.getElementById('email').value;
	if(email=="")
	{
		alert("Please Enter the Email");
		document.getElementById('email').focus();
		return false;
	}
	if (echeck(email)==false){
		email=""
		document.getElementById('email').focus();
		return false
	}
}	
	function echeck(email) {

	var at="@"
	var dot="."
	var lat=email.indexOf(at)
	var lstr=email.length
	var ldot=email.indexOf(dot)
		if (email.indexOf(at)==-1){
		   alert("Invalid E-mail ID");
		   document.getElementById('email').focus();
		   return false
		}

		if (email.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID");
		   document.getElementById('email').focus();
		   return false
		}

		if (email.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID");
			document.getElementById('email').focus();
		    return false
		}

		 if (email.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID");
			document.getElementById('email').focus();
		    return false
		 }

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

		 if (email.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID");
			document.getElementById('email').focus();
		    return false
		 }
		
		 if (email.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID");
			document.getElementById('email').focus();
		    return false
		 }

 		 return true					
	}

function confirmDelete() {
  if (confirm("Are you sure you want to delete")) {
    document.edit_form.submit(); 
  }
}
function confirmRestore() {
  if (confirm("Are you sure you want to Restore")) {
    document.restore_form.submit(); 
  }
}
function select_portfolio(str,url){
var str = str;
//alert(str);
//alert(url);
if(window.XMLHttpRequest)
			{xmlhttp = new XMLHttpRequest();
			
				
			}
			else
			{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			xmlhttp.onreadystatechange=function()
			{
				if(xmlhttp.readyState==4&& xmlhttp.status==200)
				{
					document.getElementById('changecity').innerHTML = xmlhttp.responseText;
					//alert(xmlhttp.responsetext);
					
				}
				
			}
			//hardcoded url
			//url = "http://alpha.maksansolutions.com/inpulse/admin/"+url;
		xmlhttp.open("GET",url+"?q="+str,true);
				xmlhttp.send();


}
function select_content(str,url){
var str = str;
//alert(str);
//alert(url);
if(window.XMLHttpRequest)
			{xmlhttp = new XMLHttpRequest();
			
				
			}
			else
			{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			xmlhttp.onreadystatechange=function()
			{
				if(xmlhttp.readyState==4&& xmlhttp.status==200)
				{
					document.getElementById('content').innerHTML = xmlhttp.responseText;
					//alert(xmlhttp.responsetext);
					
				}
				
			}
			//hardcoded url
			//url = "http://alpha.maksansolutions.com/inpulse/admin/"+url;
		xmlhttp.open("GET",url+"?q="+str,true);
				xmlhttp.send();


}
function ajax_content(str,url){
	
	var str = str;

if(window.XMLHttpRequest)
			{xmlhttp = new XMLHttpRequest();
			
				
			}
			else
			{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			xmlhttp.onreadystatechange=function()
			{
				if(xmlhttp.readyState==4&& xmlhttp.status==200)
				{
					
	
			
					//document.getElementById('select_service').innerHTML = xmlhttp.responseText;
					var re = xmlhttp.responseText;
					var re_array=re.split(" secondajaxcontent");
					document.getElementById('select_service').innerHTML = re_array[0];
					//document.getElementById('content').value = re_array[1];
					tinyMCE.activeEditor.setContent(re_array[1]);

					
					
				}
				
			}
			//hardcoded url
			//url = "http://alpha.maksansolutions.com/inpulse/admin/"+url;
		xmlhttp.open("GET",url+"?q="+str,true);
		
				xmlhttp.send();
				
}
