String.prototype.trim = function(){
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.left = function(num){
	return this.substring(0,num);
}
String.prototype.right = function(num){
	return this.substring(this.length-num,this.length);
}

function isNumeric(sText)
{
	return isInteger(sText) || isDouble(sText);
}

function isDouble(sText)
{
	var NumRX = /^[+-]?[0-9]+\.[0-9]+$/;
	return NumRX.test(sText);
}

function isInteger(sText)
{
	var NumRX = /^[+-]?[0-9]+$/;
	return NumRX.test(sText);
}

function isDate(day,month,year)
{	
	if (!isNumeric(day) || !isNumeric(month) || !isNumeric(year)) return false;
	if (day.length !=2 || month.length!=2 || year.length!=4) return false;
	var Meuberet = ((year % 4)==0 && (year % 100)!=0) || ((year % 400)==0);
	if (month == 2 && day >28 && !Meuberet){
		return false;
	}
	if (month<1 || month>12)
		return false;
	if (month == 1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12)
	{
		if (day<1 || day>31)
		{
			return false;
		}
	}else{
		if (day<1 || day>30)
		{
			return false;
		}
	}
	return true;
}

function CheckMail(mail)
{
	var RegExp = /^[A-Za-z\_\-0-9]+(\.[A-Za-z\_\-0-9]+)*@[A-Za-z\_\-0-9]+(\.[A-Za-z\_\-0-9]+)?(\.[A-Za-z]{2,3}){1,2}$/;
	return RegExp.test(mail);
}
function Left(str,num){
	return str.substring(0,num);
}
function Right(str,num){
	return str.substring(str.length-num,str.length);
}
function Zeros(num)
{
	var str="";
	var i;
	for (i=1; i<=num; i++)
		str+="0";
	return str;
}
function CheckZehut(m_id_num) //m_id_num must contain digits only
{
	var m_id_tmp;
	var a1, a2, a3, a4, a5, a6, a7, a8;
	var b2, b4, b6, b8;
	var m_sfx_num;
	var strMsg;
	var Response;
	    
	m_id_tmp = Left(Right(Zeros(9) + m_id_num, 9), 8)
	a1 = parseInt(Left(m_id_tmp, 1))
	a2 = parseInt(Left(Right(m_id_tmp, 7), 1)) * 2
	a3 = parseInt(Left(Right(m_id_tmp, 6), 1))
	a4 = parseInt(Left(Right(m_id_tmp, 5), 1)) * 2
	a5 = parseInt(Left(Right(m_id_tmp, 4), 1))
	a6 = parseInt(Left(Right(m_id_tmp, 3), 1)) * 2
	a7 = parseInt(Left(Right(m_id_tmp, 2), 1))
	a8 = parseInt(Right(m_id_tmp, 1)) * 2
	    
	b2 = (a2 % 10) + parseInt(a2 / 10)
	b4 = (a4 % 10) + parseInt(a4 / 10)
	b6 = (a6 % 10) + parseInt(a6 / 10)
	b8 = (a8 % 10) + parseInt(a8 / 10)
	    
	if (((a1 + b2 + a3 + b4 + a5 + b6 + a7 + b8) % 10) >= 1 && ((a1 + b2 + a3 + b4 + a5 + b6 + a7 + b8) % 10) <= 9)
		m_sfx_num = parseInt(10 - ((a1 + b2 + a3 + b4 + a5 + b6 + a7 + b8) % 10));
	else
		m_sfx_num = 0;
	    
	return (parseInt(Right((m_id_num), 1)) == m_sfx_num)
}
function SelectValue(obj)
{
	return obj[obj.selectedIndex].value;
}
function isPhone(text)
{
	var RX = /^(02|03|04|08|09|077|072)(\-)?[0-9]{7}$/;
	return RX.test(text);
}
function isCellular(text)
{
	var RX = /^05[0|2|4|7](\-)?[0-9]{7}$/;
	return RX.test(text);
}
function ShowHide(DivID)
{
	if (document.getElementById(DivID).style.display=="none")
		document.getElementById(DivID).style.display="";
	else
		document.getElementById(DivID).style.display="none";
}
function AddToCart(PID, Qty, Characteristic)
{

	var frmProductForm = document.getElementById("cart_status").contentWindow.document.forms["frmCart"];
	frmProductForm.PID.value = PID;
	frmProductForm.Qty.value = Qty;
	frmProductForm.Characteristic.value = Characteristic;
	frmProductForm.submit();
	document.getElementById("AddToCart_table"+PID).style.top = (document.body.clientHeight-100)/2+document.body.scrollTop;
	document.getElementById("AddToCart_table"+PID).style.left = (document.body.clientWidth-400)/2+document.body.scrollLeft;
	document.getElementById("AddToCart_table"+PID).style.display = "";
}
