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_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_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];}
}

function logout(url)
{
	var answer = confirm("Are you sure you want to logout?");
	if(answer)
	{
		PostForm(url,'')
	}
}

function PostSortEvent(event,sortBy,order)
{
	//alert(event + " , " + sortBy + " " + order);
	document.getElementById('hidEvent').value=event;
	document.getElementById('sortBy').value=sortBy;
	document.getElementById('order').value=order;
	document.frm.submit();
}


function PostForm(formaction,event)
{
	if(formaction!="")
	{
		document.frm.action=formaction;
	}
	document.getElementById('hidEvent').value=event;
	document.frm.submit();

}

/*function PostBack(event)
{
	document.getElementById('hidEvent').value=event;
	document.frm.submit();
}*/


function PostBack(event)
{
	document.getElementById('hidArguments').value="";
	for( var i=1 ; i < arguments.length; i++ ) 
	{
		if(document.getElementById('hidArguments').value!="")
			document.getElementById('hidArguments').value=document.getElementById('hidArguments').value+",";
		document.getElementById('hidArguments').value=document.getElementById('hidArguments').value+arguments[i];
	}
	document.getElementById('hidEvent').value=event;
	
		document.frm.submit();
		
		//document.getElementById('hidArguments').value="";
			//document.getElementById('hidEvent').value="";
}


function PostForm(action,event)
{
	for( var i=2 ; i < arguments.length; i++ ) 
	{
		if(document.getElementById('hidArguments').value!="")
			document.getElementById('hidArguments').value=document.getElementById('hidArguments').value+",";
		document.getElementById('hidArguments').value=document.getElementById('hidArguments').value+arguments[i];
	}
	//document.getElementById('hidEvent').value=event;
	//document.frm.submit();
	
	document.getElementById('hidEvent').value=event;
	document.frm.action=action;
	document.frm.submit();
}




function Delete(arg)
{
if(confirm('Are you sure you want to delete'))
 window.location=arg;
}
function confirmDeletion()
{
if(confirm('Are you sure you want to delete?'))
return true;
else
return false;
}

function confirmAction($value)
	{
		if($value=='0')
		{
			if(confirm('Are you sure you want to make this record inactive.'))
				return true;
			else
				return false;
		}
		if($value=='1')
		{
			if(confirm('Are you sure you want to make this record active.'))
				return true;
			else
				return false;
		}
	}
function  first()
{
	document.getElementById('txtPageSize1').value = document.getElementById('txtPageSize').value;
	
}
function second()
{

	document.getElementById('txtPageSize').value = document.getElementById('txtPageSize1').value;
}
function  download($filename)
{
	alert($filename);
	var arg="admin/Assets/Download/";
	document.getElementById('hid_download').value=$filename;
		document.frm.action=arg;
	
	document.frm.submit();
}
   
function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
      }
function textCounter(field,maxlimit) {
    if (field.value.length > maxlimit) // if too long...trim it!
        field.value = field.value.substring(0, maxlimit);
        // otherwise, update 'characters left' counter
}
function TinyMce()
{

tinyMCE.init({
	mode : "textareas",
		theme : "advanced",
		plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_toolbar_align : "left",
		theme_advanced_toolbar_location : "top",
		paste_use_dialog : false,
		force_p_newlines : false,
		force_br_newlines : true,
		paste_auto_cleanup_on_paste : true,
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
		theme_advanced_buttons2 : "justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons3 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo",
		theme_advanced_buttons4 : "link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons5 : "tablecontrols,|,hr,removeformat,visualaid",
		theme_advanced_buttons6 : "sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen,|,insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker",
		theme_advanced_blockformats : "p,h2,h3"
		});
	
}




function TinyMceFull()
{
tinyMCE.init({
		mode : "textareas",
		theme : "advanced",
		width : "50%",
		height : "400",
		plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_toolbar_align : "left",
		theme_advanced_toolbar_location : "top",
		paste_use_dialog : false,
		force_p_newlines : false,
		force_br_newlines : true,
		paste_auto_cleanup_on_paste : true,
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
		theme_advanced_buttons2 : "justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons3 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo",
		theme_advanced_buttons4 : "link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons5 : "tablecontrols,|,hr,removeformat,visualaid",
		theme_advanced_buttons6 : "sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen,|,insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker",
		theme_advanced_blockformats : "p,h2,h3"
		
		});
	
}


    
