var image_loader = new Array(); 
image_loader[0] = new Image();
image_loader[0].src = "/img/loading.gif";
// -----------------------------
function hideSelectObjects () {	 
	for(var i = 0;i<document.getElementsByTagName("SELECT").length;i++) {	 
		if (document.getElementsByTagName("SELECT").item(i).id != 'select1cal' && document.getElementsByTagName("SELECT").item(i).id != 'select2cal')
			document.getElementsByTagName("SELECT").item(i).style.visibility = "hidden";	 
		}	 
	}	
 
function showSelectObject () {	 
	for(var i = 0;i<document.getElementsByTagName("SELECT").length;i++) {	 
		if (document.getElementsByTagName("SELECT").item(i).id != 'select1cal' && document.getElementsByTagName("SELECT").item(i).id != 'select2cal')	 
			document.getElementsByTagName("SELECT").item(i).style.visibility = "visible";	 
		}	 
	}
function gid(id) {
	return document.getElementById(id);
	}

function checkurl(text) { 
	var v = new RegExp(); 
	v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$"); 
	if (!v.test(text)) return false;
		else return true;
	}

function c(id) {
//	window.open('http://www.wesell.co.il/click/JKPBrTq8JfzuaG9/bZcsA6J4aEgqQLq/dftGXMFfR1FLUsr');
	var xmlHttpReq = false;
	xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
	xmlHttpReq.open('POST', 'index.php?op=clicks&id=' + id, false);
	xmlHttpReq.send();
	}



function set_image(obj, img, w,h,max_h) {
	if (obj.image_load) {
		if (max_h) h = max_h;
		var url = "/image.php?img=" + img + "&width=" + w + "&max_h=" + h;
		obj.src = url;
		obj.image_load = false;
		}
	}


function windows_close() {

	showSelectObject ();

	parentObj = document.getElementById('iwindow').parentNode; 
	childObj = document.getElementById('iwindow');  
	parentObj.removeChild(childObj);
	}

function iwindow(w,h,title,url) {

	hideSelectObjects ();

	var yScroll;
	if (self.pageYOffset) 	yScroll = self.pageYOffset;
		else if (document.documentElement && document.documentElement.scrollTop)	yScroll = document.documentElement.scrollTop;
		else if (document.body) yScroll = document.body.scrollTop;

	html = '';
	html += '	<div style="position: absolute; top: 0px; left: 0px; zIndex: 999999; width: 100%; height: 100%;"><table cellpadding="0" cellspacing="0" width="100%" height="100%"><tr><td align="center" style="vertical-align: middle;">';
	html += '		<br><div style="width: '+w+'px; background: #EEEEEE; border-right: 2px solid #666666; border-bottom: 2px solid #666666; "><table width="100%" cellpadding="0" cellspacing="0">';
	html += '			<tr>';
	html += '				<td align="right" style="padding-right: 10px;"><span style="font-weight:bold; color:#404040; font-family: tahoma; font-size:12px;">'+title+'</span></td>';
	html += '				<td align="left" style="padding-left: 5px;"><a href="javascript:windows_close();"><img src="img/admin/close.gif" border="0"></a></td>';
	html += '				</tr>';
	html += '			<tr><td colspan="2"><iframe width="'+w+'" height="'+h+'" frameborder="0" allowtransparency="1" src="'+url+'"></iframe></td></tr>';
	html += '			</table></div>';
	html += '		</td></tr></table></div>';

	var objBody = document.getElementsByTagName("body").item(0);

	var objOverlay = document.createElement("div");
	objOverlay.setAttribute('id','iwindow');
	objOverlay.onclick = function () {windows_close(); return false;}
	objOverlay.style.display = 'block';
	objOverlay.style.position = 'absolute';
	objOverlay.style.top = yScroll+'px';
	objOverlay.style.left = '0';
	objOverlay.style.zIndex = '999998';
 	objOverlay.style.width = '100%';
 	objOverlay.style.height = '100%';
	objBody.insertBefore(objOverlay, objBody.firstChild);

	var obj = document.createElement("div");
	obj.setAttribute('dir','rtl');
	obj.setAttribute('id','iwindow_container');
	obj.style.display = 'block';
	obj.style.zIndex = '999999';
	obj.innerHTML = html;
	objOverlay.appendChild(obj);
	}

function iwindow_value(el,txt) {
	window.parent.gid(el).value = txt;
	}

function openit(id) {
	id = gid(id);
	if (id.style.display == 'none') {
		id.style.display = '';
		id.focus;
		} else id.style.display = 'none';
	}

function sform(form) {
	form.sbutton.disabled = "true";
	form.sbutton.innerText = "נא המתן ...";
	form.submit();
	return true;
	}

