// שבירת מסגרות
//if (self != top) top.location = self.location;

// בדיקת טופס לוגין קוביה כניסה לבעלי עסקים
function CheckEmail(src) {
	if(src.length==0){
		return false;
	}
	else{
		var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
		var regex = new RegExp(emailReg);
		return regex.test(src);
	}
}

function checkformloginbox(f)
	{
		var bool=false;

			if(!CheckEmail(f.BIZ_Email.value))
			{
				alert('נא למלא כתובת דואר אלקטרוני חוקית');
				f.BIZ_Email.focus();
			}
			else if(f.BIZ_Password.value=='')
			{
				alert('נא למלא סיסמה');
				f.BIZ_Password.focus();
			}
			else
			{		
				bool=true
			}
		return bool;
	}

// בדיקת טופס רשימת תפוצה
function checkformmailingbox(f)
	{
		var bool=false;

			if(!CheckEmail(f.emailaddress.value))
			{
				alert('נא למלא כתובת דואר אלקטרוני חוקית');
				f.emailaddress.focus();
			}
			else
			{		
				bool=true
			}
		return bool;
	}
	
// בדיקת ספרות בלבד
function CheckOnlyNumber(){
   if ((event.keyCode > 0 && event.keyCode < 45)  || 
      (event.keyCode > 57)) 
	{   
	  event.returnValue = false;
	  alert("נא למלא ספרות בלבד")
	}
}

// מאמרים
function addartreview(ARTid)
{
newWindowaart = window.open('/artAddReview.asp/ART_id/' + ARTid, 6, 'toolbar=0,location=0, directories=0, status=0, menubar=0, scrollbars=0,resizable=0, width=460, height=440, left=100, top=100'); 
newWindowaart.focus();
}

function addprodreview(PRODid)
{
newWindowaart = window.open('/prodAddReview.asp/PROD/' + PRODid, 6, 'toolbar=0,location=0, directories=0, status=0, menubar=0, scrollbars=0,resizable=0, width=460, height=500, left=100, top=100'); 
newWindowaart.focus();
}

function sendartlinktofriends(ARTid)
{
newWindowsend = window.open('/sendlinktofriends.asp/link/http:^^2biz.co.il^article' + ARTid + '.html', 5, 'toolbar=0,location=0, directories=0, status=0, menubar=0, scrollbars=0,resizable=0, width=360, height=360, left=100, top=100'); 
newWindowsend.focus();
}

function sendvodartlinktofriends(ARTid)
{
newWindowsend = window.open('/sendlinktofriends.asp/link/http:^^2biz.co.il^articlevod' + ARTid + '.html', 5, 'toolbar=0,location=0, directories=0, status=0, menubar=0, scrollbars=0,resizable=0, width=360, height=360, left=100, top=100'); 
newWindowsend.focus();
}

// מוצרים
function sendsalelinktofriends(PRODUCTid)
{
newWindowsend = window.open('/sendlinktofriends.asp/link/http:^^2biz.co.il^sale' + PRODUCTid + '.html', 5, 'toolbar=0,location=0, directories=0, status=0, menubar=0, scrollbars=0,resizable=0, width=360, height=360, left=100, top=100'); 
newWindowsend.focus();
}

function checkordersaleform(f)
	{
		var bool=false;

			if(f.PORDER_name.value=='')
			{
				alert('נא למלא שם פרטי ומשפחה');
				f.PORDER_name.focus();
			}
			else if(f.Prephone.value=='0')
			{
				alert('נא לבחור קידומת טלפון');
				f.Prephone.focus();
			}
			else if(f.PORDER_phone.value.length < 6)
			{
				alert('נא למלא טלפון');
				f.PORDER_phone.focus();
			}
			else if(!CheckEmail(f.PORDER_email.value))
			{
				alert('נא למלא כתובת דואר אלקטרוני חוקית');
				f.PORDER_email.focus();
			}
			else if(f.PORDER_notes.value=='')
			{
				alert('נא למלא את ההודעה');
				f.PORDER_notes.focus();
			}
			else
			{		
				bool=true
			}
		return bool;
	}
	
	
var min=11;
var max=28;
function ChangeFontSize(tonewsize) {
	p=document.getElementById('ARTtextsize').style.fontSize;
	currsize=parseInt(p);

	if(tonewsize)
	{
		if (currsize<max)
			newsize=currsize+1;
		else
			newsize=currsize;
	}
	else
	{
		if (currsize>min)
			newsize=currsize-1;
		else	
			newsize=currsize;
	}

	newfontsize=newsize+"px";
	document.getElementById('ARTtextsize').style.fontSize=newfontsize;
}

function mnCommonOver(imgname){
	if (document.getElementById(imgname))
	{
		document.getElementById(imgname).src = '/skin/art/cts/ch_' +imgname +'.gif';
	}
}

function mnCommonOut(imgname){
	if (document.getElementById(imgname))
	{
		document.getElementById(imgname).src = '/skin/art/cts/c_' +imgname +'.gif';
	}
}

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}

/***********************************************
* Cool DHTML tooltip script II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetfromcursorX=2 //Customize x offset of tooltip
var offsetfromcursorY=26 //Customize y offset of tooltip

var offsetdivfrompointerX=166 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=5 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointer" src="skin/hintarrow.gif">') //write out pointer image

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
}

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip

var xmlhttp

function ajaxFunctionrate_it(obj,rateValue,toid)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="http://2biz.co.il/includes/rateIt.asp?obj=" + obj + "&objid=" + toid + "&objstr=" + rateValue;
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
  {
  document.getElementById("ratetheObjok").innerHTML=xmlhttp.responseText;
  }
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}














function CheckEmail(src) {
	if(src.length==0){
		return false;
	}
	else{
		var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
		var regex = new RegExp(emailReg);
		return regex.test(src);
	}
}
function checkformcomments(f)
	{
		var bool=false;
			if(f.ARTREV_text.value==''||f.ARTREV_text.value=='הבע את דעתך...')
			{
				alert('נא כתוב את תגובתך');
				f.ARTREV_text.focus();
			}
			else if(f.ARTREV_subject.value=='')
			{
				alert('נא כתוב כותרת לתגובה');
				f.ARTREV_subject.focus();
			}
			else if(f.ARTREV_author.value=='')
			{
				alert('נא למלא שם הכותב');
				f.ARTREV_author.focus();
			}
			else if(!CheckEmail(f.ARTREV_Email.value))
			{
				alert('נא למלא אימייל');
				f.ARTREV_Email.focus();
			}
			else if(f.ARTREV_Chem.value=='')
			{
				alert('אימות אימייל - נא לחזור על האימייל שהקשתם');
				f.ARTREV_Chem.focus();
			}			
			else if(f.ARTREV_Chem.value != f.ARTREV_Email.value)
			{
				alert('אימות האימייל נכשל, יש להקיש את אותה כתובת אימייל בשני השדות המיועדים לכך');
				f.ARTREV_Chem.focus();
			}			
			else
			{		
				bool=true;
				document.getElementById("showactivecommentform").style.display='none';
				document.getElementById("showTextAreaCMNT").style.display='none';
				document.getElementById("submitcommentok").style.height='60px';
				document.getElementById("submitcommentok").innerHTML="<div class='okbox'>תגובתך נוספה בהצלחה, תודה.<br>נפרסמה בהקדם בכפוף לשיקולי המערכת.</div>";
			}
		return bool;
	}

function activecommentform(thisobj)
	{
	if(thisobj.value=='הבע את דעתך...'){thisobj.value='';};
	thisobj.style.height='200px';
	thisobj.style.background='#ffffff';
	thisobj.focus();
	document.getElementById("showactivecommentform").style.display='';
	}