function framehandler(){
	if (parent.frames.length > 0) { 
		parent.location.href = self.document.location 
	} 
}
//--------------------cookie functions-------------------------
function getCookie(NameOfCookie){
    if (document.cookie.length > 0) { 
		//alert(document.cookie);
    begin = document.cookie.indexOf(NameOfCookie+"=");       
    if (begin != -1) {           
      begin += NameOfCookie.length+1;       
      end = document.cookie.indexOf(";", begin);
      if (end == -1) end = document.cookie.length;
        return unescape(document.cookie.substring(begin, end));
    } 
  }
  return null;
}

function setCookie(NameOfCookie, value, expiredays)
{
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
	
	var theCookie = NameOfCookie + "=" + escape(value)+";";
	theCookie= theCookie + ((expiredays == null) ? "" : " expires=" + ExpireDate.toGMTString());
	theCookie = theCookie + " path=/";
	document.cookie = theCookie;
}

function delCookie (NameOfCookie) 
{
  if (getCookie(NameOfCookie)) 
  {
	var now = new Date();
	var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);
	setCookie(NameOfCookie, '', yesterday);
  
  }
}
//--------------------cookie functions-------------------------

//------------browser type-----------
isIE=document.all;
isNN=!document.all&&document.getElementById;
//------------browser type-----------

//------------------------click position-----------
function findPosX(obj)
{
	var mX = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			mX += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		mX += obj.x;
	return mX;
}

function findPosY(obj)
{
	var mY = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			mY += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		mY += obj.y;
	return mY;
}
//------------------------click position-----------

//---------------layer show hide-----------
function hideLayer(objName)
{
	popObj=get_object(objName)
	 
	if ((isIE||isNN) && popObj) 
	{
		popObj.style.visibility="hidden";
	}
}

function showLayer(clickedObj,objName,offsetX,offsetY)
{
	mX=findPosX(clickedObj);
	mY=findPosY(clickedObj);
	popObj=get_object(objName)
	if (isIE && popObj) 
	{
		xpos=mX+offsetX;
		ypos=mY+offsetY;
		popObj.style.left=xpos + "px";
		popObj.style.top= ypos+ "px";
		popObj.style.visibility="visible";
	}
	if (isNN && popObj) 
	{
		xpos=mX+offsetX+100;
		ypos=mY+offsetY+20;
		popObj.style.left=xpos + "px";
		popObj.style.top= ypos+ "px";
		popObj.style.visibility="visible";
	}
}
//---------------layer show hide-----------

//--------------object getting - cross browser------------
function get_object(objName)
{
	if (isIE)
	{
		evalText="document.all."+objName;
		Obj=eval(evalText);
	}
	else
	{
		Obj=document.getElementById(objName);
	}
	return Obj;
}

function get_hidden_obj(objName,form_name)
{
	if (isIE)
	{
		evalText="document.all."+objName;
		Obj=eval(evalText);
	}
	else
	{
		evalText="document."+form_name+"."+objName;
		Obj=eval(evalText);
	}
	return Obj;
}
//--------------object getting - cross browser------------

//----------------checkbox array checks-------------------
//check if an array of checboxes that was declered with [] has any records selected.
function is_checkbox_arr_selecetd(obj_name,form_name)
{
	var checkboxArrObj = eval('document.'+form_name+'["'+obj_name+'"]');
	if (checkboxArrObj==null)
	{
		return false;
	}
	if (checkboxArrObj.checked)
	{
		return true;
	}
	for (i=0; i<checkboxArrObj.length;i++)
	{
		if (checkboxArrObj[i].checked)
		{
			return true;
		}
	}
	return false;
}
function isArray(obj)
{
	return(typeof(obj.length)=="undefined")?false:true;
}

function select_all_checkboxes(obj_name,form_name,value)
{
	var checkboxArrObj = eval('document.'+form_name+'["'+obj_name+'"]');
	if (checkboxArrObj==null)
	{
		return;
	}
	if (!isArray(checkboxArrObj))
	{
		checkboxArrObj.checked=value;
	}
	else
	{
		for (i=0; i<checkboxArrObj.length;i++)
		{
			checkboxArrObj[i].checked=value;
		}
	}
}
//----------------checkbox array checks-------------------

function select_object(obj_id,form_name,hiddenName)
{
	var hiddenObj = eval('document.'+form_name+'.'+hiddenName);
	hiddenObj.value=obj_id;
}

function isValidEmail(str) {
   return (str.indexOf("@") > 0);
}
