/*
var head= document.getElementsByTagName('head')[0];
var General = document.getElementsByTagName('script');
var string  = "";
for(var i=0 ;i<General.length;i++)
{
	if(General[i].src.indexOf('General') > -1)
		string = General[i].src;
}
var script= document.createElement('script');
script.type= 'text/vbscript';
script.src= string.replace('General.js','VBGeneral.vbs');
head.appendChild(script);
*/
//document.oncontextmenu = function(){return false;}

function ClosePoup(URL)
{
	if(window.external.dialogArguments != null) // popup in course Player
	{
		if(window.external.dialogArguments.parent.opener!=null)
		{
			window.external.dialogArguments.parent.opener.top.location.href='"+URL+"';
			window.external.dialogArguments.parent.close();
			window.close();
		}
		else
		{
			window.external.dialogArguments.location.href='"+URL+"';
			window.close();
		}
	}
	else if(window.opener!=null)
	{
		if(window.opener.opener!=null)
		{
			window.opener.opener.top.location.href='"+URL+"';
			window.opener.close();
			window.close();
		}
		else 
		{
			window.close();
			window.opener.top.location.href='"+URL+"';
		}
	}
	else
	{
		window.top.location.href='"+URL+"';
	}
}
function ValidateExpression(value, expression)
{
    var rx = new RegExp();
    rx.compile(expression);
    return rx.test(value);
}

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"), "");
}

window.onload  = dd;
function dd()
{ 
	var windowObject = window.top.location.href;
	if(window.top==null)
	{
		window.top.location.href=window.top.location.href.substring(0,window.top.location.href.lastIndexOf('/'))+ "../KHMainDefault.aspx?ff3jppFl1ff3jppWE2zHyUtbIGhJaqbn2e0BurWR9cnQsFYdJD4D48gY7Oyff3jppaJojOff3jppIq0fRHv96H2fx98g9bNQW46EBr7SPg=="
	}
	var body = document.getElementsByTagName('body').item(0);

	resizeIframeHeight();
}
function eCoursePlayer(URL)
{			
	window.open(URL, null,"modal=yes,status=no,toolbar=no,menubar=no,location=no,top=0,left=0,fullscreen=yes");
}	
function validateFileUpload(obj, validFileExtensions){        
		var fileName = new String();        
		var fileExtension = new String();                
		// store the file name into the variable        
		fileName = obj.value;                
		// extract and store the file extension into another variable        
		fileExtension = fileName.substr(fileName.length - 3, 3);                
		// array of allowed file type extensions        
		var flag = false;                
		// loop over the valid file extensions to compare them with uploaded file       
		for(var index = 0; index < validFileExtensions.length; index++){            
			if(fileExtension.toLowerCase() == validFileExtensions[index].toString().toLowerCase()){                
			flag = true;
			}
		}                
		// display the alert message box according to the flag value        
		return flag;
	}

function VideoPlayer()
{	
	 var flag = arguments[0];
     var URL = arguments[1];     
     var dots = '';
     if(arguments[2] != null)
     dots = '../';  

     var VideoPath = URL.split('/');		
	var sQueryString =MasterClass.CryptQueryString_JS("Path="+URL).value;	
	if(VideoPath.length<4)
	{
		window.open(dots+"VideosPlayer.aspx?"+escape(sQueryString),null,"left=30,top=25,height=520,width=930,menubar=no,status=no,titlebar=no,location=no,resizable=yes,scrollbars=yes");
	}
	else
	{
		var VideoResolution = VideoPath[6];
		var ResolutionFlag = '';
		var ExtensionType;
			
		var VideoName='';
		for(i=7;i<=VideoPath.length-1;i++)
		{
			if(i==VideoPath.length-1)
			{
				var Extension = VideoPath[i].split('.')
				VideoName+=Extension[0];
				ExtensionType=Extension[1];
			}
			else
			{
				VideoName+=VideoPath[i]+'/';
			} 			
		}
			
			//To Specify flag Depend On File Extension 			
		if(ExtensionType.toLowerCase() =='flv')
		{
			// Detrmine Resolution Type
			if(VideoResolution.toLowerCase()=='low' )
			{
				ResolutionFlag = 'L';
				VideoName+='@@'+ResolutionFlag;
				window.open(dots+"VideoPlayer/Video Preview.html?Path="+escape(VideoName),null,"left=330,top=270,height=234,width=290,menubar=no,status=no,titlebar=no,location=no,resizable=no,scrollbars=0");
			}
			else if(VideoResolution.toLowerCase()=='high')
			{
				ResolutionFlag = 'H';
				VideoName+='@@'+ResolutionFlag;
				window.open(dots+"VideoPlayer/Video Preview.html?Path="+escape(VideoName),null,"left=150,top=125,height=522,width=650,menubar=no,status=no,titlebar=no,location=no,resizable=no,scrollbars=0");
			}
			else
			{
				ResolutionFlag = 'M';
				VideoName+='@@'+ResolutionFlag;
				window.open(dots+"VideoPlayer/Video Preview.html?Path="+escape(VideoName),null,"left=330,top=270,height=266,width=330,menubar=no,status=no,titlebar=no,location=no,resizable=no,scrollbars=0");
			}
		}
		else
		{
			window.open(dots+"VideoPlayer.aspx?"+escape(sQueryString),null,"left=30,top=25,height=520,width=930,menubar=no,status=no,titlebar=no,location=no,resizable=yes,scrollbars=yes");
		}
	} 		
}  
/*********************************************************/
//Dawood Banat On 9/7/2007 to Hide Show search area
		function ShowSerachStudent()
		{
			var hdnSearch = document.getElementById('hdnSearch');
		
			if(hdnSearch.value == 1 ||hdnSearch.value == 3 )
			{
				hdnSearch.value=2;
				
				document.getElementById('SearchArea').style.display = 'block';
			}
			else if(hdnSearch.value == 2)
			{
			
				hdnSearch.value=1;
				
				document.getElementById('SearchArea').style.display = 'none';
			}
				
				//resizeIframeHeight();				
				ResizeOuterInnerIframes();			
				  
				
		}
		function ShowSearch()
		{
			var hdnSearch = document.getElementById('hdnSearch');
		
			if(hdnSearch.value == 1)
			{
				document.getElementById('SearchArea').style.display = 'block';
			}
			else
			{
				document.getElementById('SearchArea').style.display = 'none';
			}
			hdnSearch.value =1;
		}
		
//Dawood banat
//To Read Cookies
function setCookie ( cname, cvalue, cexpires, cdirPath,cdomain) 
{
    var cdateExpires = new Date(cexpires)
    cdirPath = ( cdirPath.indexOf("/") == -1) ? "/" : cdirPath
    if ( (cdomain.length <1) ) 
    {
        var strNewCookie = cname + "="+ escape(cvalue) + ";" +"expires=" + cdateExpires.toGMTString() + ";" + "path =" + cdirPath + ";"
    }    
    else 
    {
		var strNewCookie = cname + "="+ escape(cvalue) + ";" +"expires=" + cdateExpires.toGMTString() + ";" + "path =" + cdirPath + ";" + "domain = " + cdomain + ";"
    }
    document.cookie = strNewCookie;
   
}
function GetCookie(sName)
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0])
    {
		var Data =aCookie[i].replace(sName+"=","");
		var Arr = Data.split("&");
		for(var j=0;j<Arr.length;j++)
		{
			if(Arr[j].split("=")[0]=="LangType")
			{
				return unescape(Arr[j].split("=")[1]);
			}
		}
    }
  }

  // a cookie with the requested name does not exist
  return null;
}
function GetCookieByName(sName)
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0])
    {
      return unescape(aCrumb[1]);
     }
  }

  // a cookie with the requested name does not exist
  return null;
}
function SetLanguge()
{
	var LangType= GetCookie("LanguageMode");
	var FirstStyle,ScondStyle;
	var i,a;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++)
	{
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("href")!="") 
		{
			if(a.getAttribute("href").indexOf("AR")!=-1)
				FirstStyle = a;
			else 
			{
				ScondStyle = a;
				break;
			}
		}
	}
	if(LangType=="1")//Arabic
	{
		document.dir="rtl";
		FirstStyle.disabled=false;
		ScondStyle.disabled=true;
	}
	else//English
	{
		document.dir="ltr";
		FirstStyle.disabled=true;
		ScondStyle.disabled=false;
	}
	return LangType;
}

function ReloadNavigation()
{
	window.top.frames['LeftNav'].location.reload(true);
}
function ReloadCRPTWizardNavigation(StepNo)
{
	//window.top.frames['CrptWizardLeftNav'].location.reload(true);
	window.top.frames['CrptWizardLeftNav'].location = 'LeftMenuSteps.aspx?WizardStep='+StepNo;
}

function CheckMaxLength(control,MaxLength)

{                 

      if (control.value.length > MaxLength)

      {

      //alert(control.value.length);

      control.value = control.value.substring(0,MaxLength);

      event.returnValue = false;                

      }

}
var MenuIsOpen = false;
		function openModal(pagePath,iWidth,iHeight,isModal){
			var iWinWidth = (iWidth) ? parseInt(iWidth) : 455;
			var iWinHeight = (iHeight) ? parseInt(iHeight) : 380;			
			pagePath = String(pagePath).toLowerCase();			
			var iAvailWidth = screen.availWidth;
			var iAvailHeight = screen.availHeight;
			if (iAvailWidth < iWinWidth) iWinWidth = iAvailWidth;
			if (iAvailHeight < iWinHeight) iWinHeight = iAvailHeight;						
			var modalReturn;				
			if (isModal)
				modalReturn = showModalDialog(pagePath,window,'dialogHeight:'+ iWinHeight+ 'px;dialogWidth:'+ iWinWidth+'px ;center: yes ;resizable: no ;scroll: no;status:no');
			else{
				if (!MenuIsOpen) showModelessDialog(pagePath,window,'dialogHeight:'+ iWinHeight+ 'px;dialogWidth:'+ iWinWidth+'px ;center: yes ;resizable: no ;scroll: yes;help:no; status:no;');
				MenuIsOpen = true;						
			}			
			if (event && isModal)
			{
				event.cancelBubble = true;
				event.returnValue = false;			
			}						
		}


var objAddEndDateCalendar;
function DisplayAddEndDate(objBtn,txtBoxName,dvCalendarID)
 {


 var txtBox ='';
 var hdn ='';
 var frm = document.forms[0];
 for(j=0;j<frm.length;j++)
 {
    var controlName = frm.elements[j].id;
    if( controlName.indexOf(txtBoxName) != -1)
     txtBox = controlName;    
    else  if( controlName.indexOf('hdnAddEndDate') != -1)
     hdn = controlName;
 }
 
   try {objAddEndDateCalendar = new Calendar(new Date(), document.getElementById(dvCalendarID),document.all[txtBox],'objAddEndDateCalendar', document.all[hdn] , true, false); }
   catch(ex) { alert(ex.message); }
 }
 
 
function IsNumeric(obj)
		{
		var sText=obj.value;
		var ValidChars = "0123456789";
		var IsNumber=true;
		var Char;

		 
		for (i = 0; i < sText.length && IsNumber == true; i++) 
			{ 
			Char = sText.charAt(i); 
			if (ValidChars.indexOf(Char) == -1) 
				{
				IsNumber = false;
				}
			}
		if(! IsNumber)
		{
		alert("Please enter just numbers");
		obj.value='';
		}
		
		   
		}


// Delete from Datagrid using CheckBoxes
function setCheckClearAll(obj)
{

	try
	{
		if(obj.checked)
		{
			document.all["hdnDelIds"].value="";
			for(i=0;i<document.forms(0).elements.length;i++)
			{
				if(document.forms(0).elements[i].type=="checkbox")
				{
					if(obj.id!=document.forms(0).elements[i].id)
					{
						document.forms(0).elements[i].checked=true;
						setChecked(document.forms(0).elements[i]);
					}
				}
			}
		}
		else
		{
			for(i=0;i<document.forms(0).elements.length;i++)
			{
				if(document.forms(0).elements[i].type=="checkbox")
				{
					if(obj.id!=document.forms(0).elements[i].id)
					{
						document.forms(0).elements[i].checked=false;
						setChecked(document.forms(0).elements[i]);
					}
				}
			}
		}
					
	}
	catch(ex)
	{alert(ex.message);}
}
			
			
// Delete from Datagrid using CheckBoxes			
function setChecked(obj)
{

	try
	{
		if(document.all["hdnDelIds"].value!="")
		{
			var strFirstPart;
			var strSecondPart;
			var strFinal;
			var strLen;
			var strInitIds="," + document.all["hdnDelIds"].value + ",";
			var strCurrentID="," + obj.value + ",";
			if(strInitIds.indexOf(strCurrentID)>-1)
			{
				strFirstPart=strInitIds.substring(0,strInitIds.indexOf(strCurrentID)+1);
				strLen=strCurrentID.length;
				strSecondPart=strInitIds.substr(strInitIds.indexOf(strCurrentID)+strLen,strInitIds.length);
				strFinal=strFirstPart + strSecondPart;
				if(strFinal.lastIndexOf(",")>0)
				{
					document.all["hdnDelIds"].value=strFinal.substring(1,strFinal.lastIndexOf(","));
				}
				else
				{
					document.all["hdnDelIds"].value="";
				}
				document.all["hdnChkIdInc"].value=eval(eval(document.all["hdnChkIdInc"].value) - 1);
			}
			else
			{
				document.all["hdnDelIds"].value=document.all["hdnDelIds"].value + "," + obj.value;
				document.all["hdnChkIdInc"].value=eval(eval(document.all["hdnChkIdInc"].value) + 1);
			}
		}
		else
		{
		document.all["hdnDelIds"].value=obj.value; 
		document.all["hdnChkIdInc"].value=1;
		
	}
	if(document.all["hdnChkIdInc"].value==document.all["hdnChkId"].value)
	{
		document.all["chkCheckAll"].checked=true;
	}
	else
	{
		document.all["chkCheckAll"].checked=false;
	}
	}
	catch(ex)
	{
		alert(ex.message);
	}	
}



//MMohammad
function SelectAll(CheckBoxControl,CheckBoxName) 
	{
		if (CheckBoxControl.checked == true) 
			{
				var i;
				for (i=0; i < document.forms[0].elements.length; i++) 
				{
					if ((document.forms[0].elements[i].type == 'checkbox') && 
					(document.forms[0].elements[i].name.indexOf(CheckBoxName) > -1)) 
					{
						document.forms[0].elements[i].checked = true;
					}
				}
			} 
		else 
			{
				var i;
				for (i=0; i < document.forms[0].elements.length; i++) 
				{
					if ((document.forms[0].elements[i].type == 'checkbox') && 
					(document.forms[0].elements[i].name.indexOf(CheckBoxName) > -1)) 
					{
						document.forms[0].elements[i].checked = false;
					}
				}
			}
	}

function ShowEditableRow(Row1,Row2,hidden)
{
	
	for (i=0; i < document.forms[0].elements.length; i++) 
		{
		if (document.forms[0].elements[i].name.indexOf(hidden) > -1) 
			
			{
				var h;
				h =  document.forms[0].elements[i];
				
				x=document.getElementById('trEdit' + h.value);
				y=document.getElementById('trData' + h.value);
				if(x && y)
				{
				x.style.display = "none";
				y.style.display = "inline";
				
				}
				
			}		
		}
	document.getElementById(Row1).style.display = "none";	
	document.getElementById(Row2).style.display = "inline";
	var AddRow = document.getElementById('trAddNew');
	if (AddRow)
		{
			AddRow.style.display = "none";
		}
		
	//Added By Hussein for add new row for evaluation scale
	var trAddNewScale = document.getElementById('trAddNewScale');
	if (trAddNewScale)
		{
			trAddNewScale.style.display = "none";
		}
		ResizeOuterInnerIframes();			
	
	}
	
	// for collaps ... naeem mehyar 15/9/2006
	function Expanding(RowName,RowID)
	{	
		var tr = document.getElementsByName(RowName + RowID);
		
		for(var i=0;i<tr.length;i++)
		{
			var controlName = tr[i];
			if ( controlName.style.display == "none")
			{
				controlName.style.display = "inline";
				document.getElementById( RowName+"Img" + RowID).src = "../Images/Iframe_pages/Arrow-Opened.gif";
			}
			else
			{
				controlName.style.display = "none";
				document.getElementById(RowName+"Img" + RowID).src = "../Images/Iframe_pages/Arrow-Closed.gif";
			}
		}
		//resizeIframeHeight();
		ResizeOuterInnerIframes();			
    }
         
    function GetHiddenID()
    {
        var hdns = document.getElementsByTagName("input");
        var hdnExpand;
        for(i=0;i<hdns.length;i++)
        {
            if(hdns[i].type == 'hidden')
            {
			if(hdns[i].id.indexOf("hdnExpandedTR") != -1)
			{					  
				hdnExpand =  hdns[i];
				break;
			}
            }
        }
        
        return hdnExpand;
    }
         
         //For Expanding and saving the selected rows ...mohammadb @26042007
        function ExpandingAndPreserve(RowName,RowID)
		{			  
			var tr = document.getElementsByName(RowName + RowID);
			for(var i=0;i<tr.length;i++)
			{
			var controlName = tr[i];
			if ( controlName.style.display == "none")
				{
					controlName.style.display = "inline";
					document.getElementById( RowName+"Img" + RowID).src = "../Images/Iframe_pages/Arrow-Opened.gif";
				}
			else
				{
					controlName.style.display = "none";
					document.getElementById(RowName+"Img" + RowID).src = "../Images/Iframe_pages/Arrow-Closed.gif";
				}
			}
			
				var hdnTR;
				if(document.getElementById("hdnExpandedTR")!= null)
				 hdnTR = document.getElementById("hdnExpandedTR");
				else
				  hdnTR = GetHiddenID();
				 
			if (document.getElementById(RowName + RowID).style.display == "inline")
			{				
				if(hdnTR.value.indexOf(","+RowID+",") == -1)
				{				
					if(hdnTR.value == "")
						hdnTR.value = ","+RowID+",";
					else
						hdnTR.value +=RowID+",";
					}
			}
			else
			{
				if(hdnTR.value.indexOf(","+RowID+",") != -1)
				{
					var oRegex = new RegExp(','+RowID+',','g');
					hdnTR.value  = hdnTR.value.replace(oRegex,',');
					}
			}
			
			if(hdnTR.value == ',')
				hdnTR.value = '';
						
			//For recalculate the frame height
			if(document.frames.frameElement.id == "main")//mohammadb @04012007 
			{
				document.frames.frameElement.height = document.body.scrollHeight;
			}
			
        } 
          
     // Calendar
   	function track(e) { 
    var x = (window.event) ? window.event.x : e.pageX; 
    var y = (window.event) ? window.event.y : e.pageY; 
    window.status = 'x=' + x + '; y=' + y; 
    alert(window.status) ; 
   } 



// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

// Main function to retrieve mouse x-y pos.s


	
		var IE = document.all?true:false

		// If NS -- that is, !IE -- then set up for mouse capture
		if (!IE) document.captureEvents(Event.MOUSEMOVE)


     function ShowCalendar(ImageId,TextId)
	{
		
		var x;
		var y;
		
		//y = document.getElementById(ImageId).offsetTop + this.parent.screenTop + this.frames.screenTop+ document.body.scrollTop + 5;
		//x = document.getElementById(ImageId).offsetLeft + this.frames.screenLeft+ document.body.scrollLeft + 8;
		
		//if (document.layers)  document.captureEvents(Event.MOUSEMOVE); 
		//document.onmousemove = track; 

		  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + this.screenLeft
    tempY = event.clientY + this.screenTop - 140
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  

		
		document.getElementById(ImageId);
		//	x = window.event.clientX + document.body.scrollLeft;
		//	y = window.event.clientY + document.body.scrollTop;
		var oDate = new Date();
	
		//Note here: Date object's format is different than calendar's date format
		//debugger;
		//set as a calendar's current value
		if(document.getElementById(TextId).value == "")
			value =  (oDate.getMonth()+1) + '/' + oDate.getDate() + '/' + oDate.getFullYear();
		else
		{
			value = document.getElementById(TextId).value;
			value = value.split('/');
			value = value[1]+'/'+value[0]+'/'+value[2];
		}
			
		documaent.all[TextId].value = window.showModalDialog('../Scripts/Calendar.htm',value, 'dialogLeft:'+tempX+'px;dialogTop:'+tempY+'px;dialogHeight:235px;dialogWidth:265px;center:No;help:No;scroll:No;resizable:No;status:No;');
	}
///***********************************Trim Function***********************

function Trim(TrimStr,TrimType)
		{		
		    if(parseInt(TrimType) == 1 || parseInt(TrimType)== 0) //Left Trim Or both Trim
		    {
				while(TrimStr.charAt(0) == " ")
				{
					TrimStr = TrimStr.substring(1,TrimStr.length);
				}
			}
			
			if(parseInt(TrimType) == 2 || parseInt(TrimType) == 0) //Right Trim Or both Trim 
		    {
				while(TrimStr.charAt(TrimStr.length-1) == " ")
				{
					TrimStr = TrimStr.substring(0,TrimStr.length-1);
				}				  
			}	    
		  return TrimStr;	
		}
		
		//-------------------End Trim-----------------------------
//******************************************************************

var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}

	month=strMonth
	day=strDay
	year=strYr	
		
	
		if (pos1==-1 || pos2==-1){
			alert("The date format should be : mm/dd/yyyy")
			return false
		}
		if (strMonth.length<1 || month<1 || month>12||month.length>2 )
		{
			return false
		}
	
			if (strDay.length<1 || day<1 || day>31 ||day.length>2|| (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
				return false
			}
	
	
		if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
			return false
		}
		if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
			return false
		}
	
return true
}

function ValidateForm(ObjCtrl,objText)
{
	var dtext=objText
	var dt=ObjCtrl	
	
	if(Trim(objText,0)=="")
	{
		return	true;
	}
	
	day   = dtext.split('/')[0];
    month = dtext.split('/')[1];
    year  = dtext.split('/')[2];
    zyadeh =dtext.split('/')[3];
    dtext = month +'/'+ day + '/'+year;
	if(zyadeh!= null)
	{
			alert('Please enter a valid date format.');
			return false
	}
	if (isDate(dtext)==false)
	{
		dt.focus()
		return false
	}
    return true
 }
 
 function ResetHomePage()
 {
	window.top.document.getElementById("btnReset").click();
	return false;
 }

	function OnlyNumber()
	{			
		if(event.keyCode >= 48 && event.keyCode <= 57)
		{				
			return true;
		}
		return false;				
	}
	function OnlyNumberWithunlimited()
	{
		if((event.keyCode >= 48 && event.keyCode <= 57) || event.keyCode == 45)
		{
			return true;
		}
		return false;				
	}

//Added By Hussein To resize Iframe (for example After Collapse )
function resizeIframeHeight()
{
	if(document.frames.frameElement != null)
	{
		if(document.frames.frameElement.id == "main")
		{
			document.frames.frameElement.height = document.body.scrollHeight;			
		}
	}	
}

//Added To resize Inner and Outer Iframes
function ResizeOuterInnerIframes()
{
	//Created By Barhouma
	var diffHeight = 0;				
	if(document.frames.frameElement != null)
	{
		diffHeight = document.body.scrollHeight - document.frames.frameElement.height;
		document.frames.frameElement.height = document.body.scrollHeight;
	}					
	 
	 if(document.frames.frameElement != null && document.frames.frameElement.document.frames.frameElement != null)//main iFrame
	 {
		var topiframe = document.frames.frameElement.document.frames.frameElement;	
		topiframe.height = parseInt(topiframe.height) + parseInt(diffHeight);	
	 }
}
//******************************************************************
function OnlyNumberAndFloat()
{			   
	var txtValue = event.srcElement.value;
	var DotCount = 0;
	if((event.keyCode >= 48 && event.keyCode <= 57) || event.keyCode==46)
	{ 
		if(event.keyCode==46) 
		{ 			
			if(txtValue.indexOf('.') != -1)
				return false;
			else
				return true; 
		}
		
		return true;                                  	
	}

	return false;	
}		






var horizontal_offset="9px" //horizontal offset of hint box from anchor link

	/////No further editting needed

	var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.
	var ie=document.all
	var ns6=document.getElementById&&!document.all

	function getposOffset(what, offsettype)
	{
		var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
		var parentEl=what.offsetParent;
		while (parentEl!=null)
		{
			totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
			parentEl=parentEl.offsetParent;
		}
		return totaloffset;
	}

	function iecompattest()
	{
		return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}

	function clearbrowseredge(obj, whichedge)
	{
		var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
		if (whichedge=="rightedge")
		{
			var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
			dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
			if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
			edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
		}
		else
		{
			var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
			dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
			if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
			edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
		}
		return edgeoffset
	}

	function showhint(menucontents, obj, e, tipwidth)
	{
		if ((ie||ns6) && document.getElementById("hintbox"))
		{
			var LangType= GetCookie("LanguageMode");
			if(LangType=="1")//Arabic
			{
				dropmenuobj=document.getElementById("hintbox")
				dropmenuobj.innerHTML=menucontents
				dropmenuobj.style.right=dropmenuobj.style.top= 440
				
				if (tipwidth!="")
				{
					dropmenuobj.widthobj=dropmenuobj.style
					dropmenuobj.widthobj.width=tipwidth
				}
				dropmenuobj.x=getposOffset(obj, "left")
				dropmenuobj.y=getposOffset(obj, "top")
				dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
				dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
				dropmenuobj.style.visibility="visible"
				obj.onmouseout=hidetip
			}
			else
			{
				dropmenuobj=document.getElementById("hintbox")
				dropmenuobj.innerHTML=menucontents
				dropmenuobj.style.left=dropmenuobj.style.top=-500
				
				if (tipwidth!="")
				{
					dropmenuobj.widthobj=dropmenuobj.style
					dropmenuobj.widthobj.width=tipwidth
				}
				dropmenuobj.x=getposOffset(obj, "left")
				dropmenuobj.y=getposOffset(obj, "top")
				dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
				dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
				dropmenuobj.style.visibility="visible"
				obj.onmouseout=hidetip
			}
		}
	}

	function hidetip(e)
	{
		dropmenuobj.style.visibility="hidden"
		dropmenuobj.style.left="-500px"
	}

	function createhintbox()
	{
		var divblock=document.createElement("div")
		divblock.setAttribute("id", "hintbox")					
		document.body.appendChild(divblock)
	}

	if (window.addEventListener)
		window.addEventListener("load", createhintbox, false)
	else if (window.attachEvent)
		window.attachEvent("onload", createhintbox)
	else if (document.getElementById)
		window.onload=createhintbox
		
		
		
/*Hazem for Rating*/
function $(v,o) { return((typeof(o)=='object'?o:document).getElementById(v)); }
function $S(o) { return((typeof(o)=='object'?o:$(o)).style); }
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function abPos(o) { var o=(typeof(o)=='object'?o:$(o)), z={X:0,Y:0}; while(o!=null) { z.X+=o.offsetLeft; z.Y+=o.offsetTop; o=o.offsetParent; }; return(z); }
function XY(e,v) { var o=agent('msie')?{'X':event.clientX+document.body.scrollLeft,'Y':event.clientY+document.body.scrollTop}:{'X':e.pageX,'Y':e.pageY}; return(v?o[v]:o); }
var Utility = {
	iif: function(expression,TruePart,FalsePart) {
		
		return (expression)?TruePart:FalsePart;
	}
};

star={};

star.mouse=function(e,o) 
{ 
    if(star.stop || isNaN(star.stop)) 
    { 
        star.stop=0;
    	document.onmousemove=function(e) { 
    	                                    var n=star.num;
			                                var p=abPos($('star'+n)), x=XY(e), oX=x.X-p.X, oY=x.Y-p.Y; star.num=o.id.substr(4);
			                                
		                                    if(oX<1 || oX>84 || oY<0 || oY>19) 
		                                    { 
		                                        star.stop=1;
		                                        star.revert();		                                
		                                    }
		                                    else
		                                    {
			                                    $S('starCur'+n).width=oX+'px';
                                    			$S('starUser'+n).color='#111';
			                                    $('starUser'+n).innerHTML=Math.round(oX/84*100)+'%';	
	                                            $('starUser'+n).style.color='#888';	                                                
		                                     }
	                                      };
    }
};

star.update=function(e,o) { 
                            var n=star.num, v=parseInt($('starUser'+n).innerHTML);
	                        n=o.id.substr(4); 
	                        $('starCur'+n).title=v;
	                        
	                        document.getElementById("hdnRating").value= v;                          
							
	                      };

star.revert=function() { 
                            var n=star.num, v=parseInt($('starCur'+n).title);
	                        $S('starCur'+n).width=Math.round(v*84/100)+'px';
	                        $('starUser'+n).innerHTML=(v>0?Math.round(v)+'%':'');
	                        $('starUser'+n).style.color='#888';
	                        document.onmousemove='';
                        };
                        
star.Load=function(Val) { 
                            var n=star.num, v=Val;
                            $S('starCur'+n).width=Math.round(v*84/100)+'px';
	                        $('starUser'+n).innerHTML=(v>0?Math.round(v)+'%':'');
	                        $('starUser'+n).style.color='#888';
	                        document.onmousemove='';
                        };

star.num=0;

/*End Rating Script*/
/*****************************************************************************************************************************/
var Pat = document.location
var URL = Pat.protocol+"//"+Pat.host+"/"+Pat.pathname.split("/")[1]+"/";
/*if(document.getElementById) 
{
  window.alert = function(txt) 
  {
	 window.showModalDialog(URL+"tes.htm?text="+txt+"&Type=1",window,'dialogLeft:260px;dialogTop:260px;dialogHeight:140px;dialogWidth:350px;center:No;help:No;scroll:No;resizable:0;status:No;')
  }
}
if(document.getElementById) 
{
  window.confirm = function(txt) 
  {
	var Test = window.showModalDialog(URL+"tes.htm?text="+txt+"&Type=0",window,'dialogLeft:260px;dialogTop:260px;dialogHeight:140px;dialogWidth:350px;center:No;help:No;scroll:No;resizable:0;status:No;')
	return Test==null?false:Test
  }
}
function GetProjectPath()
{
	var Pat = document.location
	var URL = Pat.protocol+"//"+Pat.hostname+"/"+Pat.pathname.split("/")[0]+"/";
	return URL;
}*/




// for collaps ... naeem mehyar 15/9/2006
function ExpandingFromIfram(RowName,RowID)
{	
	var tr = document.getElementsByName(RowName + RowID);
	
	for(var i=0;i<tr.length;i++)
	{
		var controlName = tr[i];
		if ( controlName.style.display == "none")
		{
			controlName.style.display = "inline";
			document.getElementById( RowName+"Img" + RowID).src = "../Images/Iframe_pages/Arrow-Opened.gif";			
		}
		else
		{
			controlName.style.display = "none";
			document.getElementById(RowName+"Img" + RowID).src = "../Images/Iframe_pages/Arrow-Closed.gif";			
		}
		
		resizeIframeHeight();
	}

	var diffHeight = 0;				
	if(parent.document.frames.frameElement != null)
	{
		diffHeight = parent.document.body.scrollHeight - parent.document.frames.frameElement.height;
		parent.document.frames.frameElement.height = parent.document.body.scrollHeight;
		//document.frames.frameElement.height=document.body.scrollHeight;
	}	
}
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

try {
var pageTracker = _gat._getTracker("UA-10860410-1");
pageTracker._trackPageview();
} catch(err) {}

/*
window.confirm= function (str)
{
	execScript('n = msgbox("'+str+'","4132")', "vbscript");
    return(n == 6);
}
*/

window.top.scroll(0,0);
/********************************************************************************************/
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_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr)
for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}


/********************************************************************************************/

//Disable right click script 
//visit http://www.rainbow.arch.scriptmania.com/scripts/ 
/*
var message="Sorry, right-click has been disabled"; 
/////////////////////////////////// 
function clickIE() {if (document.all) {(message);return false;}} 
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) { 
if (e.which==2||e.which==3) {(message);return false;}}} 
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} 
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} 
document.oncontextmenu=new Function("return false")


document.onkeydown = function()
{
	if(window.event && window.event.keyCode == 116)
	{ // Capture and remap F5  
		window.event.keyCode = 505;  
	}
	if(window.event && window.event.keyCode == 505)
	{ // New action for F5  
		return false;
		// Must return false or the browser will refresh anyway  
	}  
}
*/
/********************************************************************************************/
