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_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_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];}

}

// editor pop-up

var popUpWin=0;

function popUpWindow(URLStr, width, height)

{

  if(popUpWin)

  {

    if(!popUpWin.closed) popUpWin.close();

  }

  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+'');

}



function submenu(id)

{

	try

	{

		document.getElementById(id).style.display="table-row";

	}

	catch(eIE)

	{

	    document.getElementById(id).style.display="inline";

	}

}

function chk_register()

{		

		

		if(document.getElementById('FName')){

			if(trim(document.alogin.FName.value) == "") 

			{

			alert("Please enter the First Name");

			document.alogin.FName.focus();

			return false;

			}

		}

		if(document.getElementById('Email')){

			if(document.alogin.Email.value == "")

			{

			alert("Please enter the Email ID");

			document.alogin.Email.focus();

			return false;

			}

		}

		if(document.getElementById('Email')){

			if(!isEmail(document.alogin.Email.value ))

			{

			alert("Please Ckeck your Email format");

			document.alogin.Email.focus();

			return false;

			}

		}

		if(document.getElementById('text_subject')){

			if(trim(document.alogin.text_subject.value) == "") 

			{

			alert("Please enter the Subject");

			document.alogin.text_subject.focus();

			return false;

			}

		}

		if(document.alogin.message)	

		{

			

			if(trim(document.alogin.message.value) == "")

			{

			alert("Please Enter Message");

			document.alogin.message.focus();

			return false;

			}

		}

		if(document.alogin.scode)

		{

			if(document.alogin.scode.value == "") 

			{

				alert("Please enter the Security Code");

				document.alogin.scode.focus();

				return false;

			}

		}

		document.getElementById("submit").disabled = true;

		return true;

} 

function trim(str, chars) {

    	return ltrim(rtrim(str, chars), chars);

}



function ltrim(str, chars) {

		chars = chars || "\\s";

		return str.replace(new RegExp("^[" + chars + "]+", "g"), "");

	}



function rtrim(str, chars) {

		chars = chars || "\\s";

		return str.replace(new RegExp("[" + chars + "]+$", "g"), "");

	}	



// Register Form

function isEmail(email) 

{

  if ((email.indexOf('@', 0) == -1) || email.indexOf('.') == -1) 

  {

    return false;

  }

 else { return true; }

}

			

			

function IsNumeric(str)	

	 {

	 	var no=true,i,s1;	

		var Chr = "0123456789._-";

		for (i = 0; i < str.length ; i++)

      	{ 

      		s1= str.charAt(i); 

      		if (Chr.indexOf(s1) == -1) 

         	{

         		no = false;

         	}

      	}

		if(no==false)

		{

			return false;

		}

		else

		{

			return true;

		}

	 }

function vdetete(Id,PageType)

{

	var stat;

	

	stat =  confirm("Are you sure you want to delete?"); 



	  if(stat==true)

	  {

	 	 if(Id!="")

  		 {

 			//location.href="Inside.php?CID="+id+"CPID="+pid+"Type=Plist&Action=delete";

			//alert(proid);

			location.href="all_delete.php?PageType="+PageType+"&Id="+Id;

		}

	  }

	  else

	  	return false;

}	

function show_div(id_show,id_hide)

{

	///alert("test");

	//alert(id_show+':'+id_hide);

	if(document.getElementById(id_hide))

	{

		document.getElementById(id_hide).style.display="none";

	}

	try

	{

		document.getElementById(id_show).style.display="block";

	}

	catch(eIE)

	{

	    document.getElementById(id_show).style.display="inline";

	}

}

function hide_div(id_show,id_hide)

{

	///alert("test");

	//alert(id_show+':'+id_hide);

	document.getElementById(id_hide).style.display="none";

	try

	{

		document.getElementById(id_show).style.display="block";

	}

	catch(eIE)

	{

	    document.getElementById(id_show).style.display="inline";

	}

}

function form_check(id)

{

	

	//alert(id);

	if(document.getElementById('title'))

	{

		if(trim(document.getElementById('title').value) == "") 

		{

			alert("Please enter a title");

			document.getElementById('title').focus();

			return false;

		}

	}

	if(document.getElementById('order'))

	{

		if(document.getElementById('order').value == "") 

		{

			alert("Please enter an order no.");

			document.getElementById('order').focus();

			return false;

		}

	}

	if(!IsNumeric(document.getElementById('order').value))

	{

			alert("Please enter an integer value in the order field");

			document.getElementById('order').focus();

			return false;

	}

	/*if(document.getElementById('order'))

	{

		if(document.getElementById('order').value == "") 

		{

			alert("Please enter an order no.");

			document.getElementById('order').focus();

			return false;

		}

	}*/

	//alert(id);

	if(id==6)

	{

		if(document.getElementById('image1'))

		{

			if(document.getElementById('image1').value == "") 

			{

				alert("Please select an image for title");

				document.getElementById('image1').focus();

				return false;

			}

		}

		if(document.getElementById('image_over'))

		{

			if(document.getElementById('image_over').value == "") 

			{

				alert("Please select an image for mouseover");

				document.getElementById('image_over').focus();

				return false;

			}

		}

	}

	document.getElementById('submit').disabled = true;

	return true;

}

function form_check_edit(id)

{

		

	if(document.getElementById('edit_info').style.display!='none')

	{

			if(document.getElementById('title'))

			{

				if(trim(document.getElementById('title').value) == "") 

				{

					alert("Please enter a title");

					document.getElementById('title').focus();

					return false;

				}

			}

			/*if(document.getElementById('order'))

			{

				if(document.getElementById('order').value == "") 

				{

					alert("Please enter an order no.");

					document.getElementById('order').focus();

					return false;

				}

			}

			if(!IsNumeric(document.getElementById('order').value))

			{

					alert("Please enter an integer value in the order field");

					document.getElementById('order').focus();

					return false;

			}*/

			//alert(id);

			if(id==6)

			{

					if(document.getElementById('image1').value == "" && document.getElementById('old_image').value == "") 

					{

						alert("Please select an image for title");

						document.getElementById('image1').focus();

						return false;

					}

				     if(document.getElementById('image_over').value == "" && document.getElementById('old_image_over').value == "") 

					{

						alert("Please select an image for mouseover");

						document.getElementById('image_over').focus();

						return false;

					}

				

			}

	}

	document.getElementById('submit').disabled = true;

	return true;

}

function add_news()

{

	

	//alert(id);

	if(document.getElementById('title'))

	{

		if(trim(document.getElementById('title').value) == "") 

		{

			alert("Please enter a title");

			document.getElementById('title').focus();

			return false;

		}

	}

	document.getElementById('submit').disabled = true;

	return true;

}

function button_disabled(id)

{

	document.getElementById(id).disabled = true;

}