if (parent.document.getElementById('TitleFrame')){
parent.document.getElementById('TitleFrame').innerHTML = "<font color=red>در حال بارگذاري  ...</font>";
}

var ParentName=null;

function CheckChanged()
{
    //alert(event.srcElement.checked);
	if(event.srcElement.checked)
		event.srcElement.parentElement.style.backgroundColor="#FFE3E3";
	else
		event.srcElement.parentElement.style.backgroundColor="";
}
function SelectAllCB( Sel )
{
    /*
	for(i = 0; i < document.all.length; i++)
	{
		if( document.all(i).tagName=="INPUT" &&
		    document.all(i).type=="checkbox" )
			document.all(i).checked=Sel;
	}
    */
    if(Sel)
        $("input:checkbox").attr('checked', 'checked');
    else
        $("input:checkbox").removeAttr('checked');
}
function InvertAllCB()
{
    /*
	for(i = 0; i < document.all.length; i++)
	{
		if( document.all(i).tagName=="INPUT" &&
		    document.all(i).type=="checkbox" )
		{
			document.all(i).checked=!document.all(i).checked;
			if(document.all(i).checked)
				document.all(i).parentElement.style.backgroundColor="#FFE3E3";
			else
				document.all(i).style.backgroundColor="";
		}
	}
    */
    $('input:checkbox').each(function ()
    {
        if ($(this).attr('checked') || $(this).attr('checked') == 'checked') {
            $(this).attr("autocomplete", "off");
            $(this).removeAttr('checked');
            this.parentElement.style.backgroundColor = "#FFE3E3";
        }
        else {
            $(this).attr('checked', 'checked');
            this.style.backgroundColor = "";
        }
    });
}

function GoToLink(Link, Condition, Name, Target, NavAll) {
	var TheForm = document.createElement("FORM");
	TheForm.id = "MyPostForm";
	TheForm.name = "MyPostForm";
	TheForm.action = Link;
	TheForm.method = "POST";
	TheForm.style.position = "absolute";
	if (Target != null)
		TheForm.target = Target;
	document.body.appendChild(TheForm);

	var Value=Name;
	if (Name == null)
		Value = "";
	var n1 = document.createElement("INPUT");
	n1.name = "Name";
	n1.value = Value;
	n1.type = 'hidden';
	TheForm.appendChild(n1);

	var n2 = document.createElement("INPUT");
	if (Condition != null) {
		//var TheInputEditor = document.createElement("<input type=hidden name='Condition' value=\"" + Value + "\" >");
		Value = Condition;
		n2.name = "Condition";
		n2.value = Value;
		n2.type = 'hidden';
		TheForm.appendChild(n2);
	}
	var n3 = document.createElement("INPUT");
	if (NavAll != null) {
		Value = NavAll;
		n3.name = "NavAll";
		n3.value = Value;
		n3.type = 'hidden';
		TheForm.appendChild(n3);
	}

	var n4 = document.createElement("INPUT");
	if (Target != null) {
		Value = Target;
		n4.name = "Target";
		n4.value = Value;
		n4.type = 'hidden';
		TheForm.target = Target;
		TheForm.appendChild(n4);
	}

	TheForm.submit();
}


function DelSelection()
{
	//FillStates(document.all.DelStates);
	//document.all.DelSelBtn.click();
}
function FillStates( TextObj )
{
    /*
	var SelStarted=false, SelEnded=false;
	var IndexCounter=0;
	TextObj.value="";
	for(i = 0; i < document.all.length; i++)
	{
		if( document.all(i).tagName=="INPUT" &&
		    document.all(i).type=="checkbox" )
		{
			if(document.all(i).checked)
			TextObj.value += ","+document.all(i).id.substring(1);
		}
	}
    */
    TextObj.value = "";
    $('input:checkbox').each(function () {
        if ($(this).attr('checked') || $(this).attr('checked') == 'checked') {
            TextObj.value += "," + $(this).attr('id').substring(1);
        }
    });

}

//--- By Mova
function InU() {
    return;
	event.srcElement.style.borderColor='#666666';
	event.srcElement.style.backgroundColor='#ffffff';
	event.srcElement.select();
}
function InD() {
    return;
    event.srcElement.style.borderColor = 'gray';
	event.srcElement.style.backgroundColor='#F5F5F5';
}
function BuU() {
    return;
    event.srcElement.style.borderColor = 'EF791C';
	event.srcElement.style.borderWidth=2;
}
function BuD() {
    return;
    event.srcElement.style.borderColor = 'gray';
	event.srcElement.style.borderWidth=1;
}
// End by Mova

function Indilate(taStrr){
	var ty
	testcon = "'\"+()×!#$%^&*()+؟|\\;:></~`"
	for (ty=0; ty<testcon.length; ty++){
		if (taStrr.indexOf(testcon.substr(ty,1))>-1) return true;
	}
	return false;
}
function dochk()
{
	 checkkon();
}
function toClip(matlab)
{
	if (confirm("اطلاعات زير وارد كليپ‏بورد شود؟\n\n" + matlab))
	{
		if (clipboardData.setData("text", matlab)) alert(":اطلاعات زير در كليپ‏بورد قرار گرفت\n\n" + clipboardData.getData("text") + "\n\n!آن را مي‏توانيد در هر جا كه مايل باشيد بچسبانيد");
	}
}