function gid(id) {
	return window.document.getElementById(id);
	}

function sms_parpar2(mydurl) {
	//http://sms.fav.co.il/
	mydurl = basehref+'index.php?dir=app_misc&page=smspic&op=iframe'+mydurl;
	csmewindow(500,420,'הפורטל הסלולרי',mydurl);
	}

function srcFromFlash(src,id,size,type,name) {
	if (id) {
		gid(id).value = src;
		}
	}

function uploadStart() {

	}

function numbersOnly() {
	if (event.keyCode<48||event.keyCode>57) return false
	}

function folderString () {
	letter = String.fromCharCode(event.keyCode);
	var validchars = "abcdefghijklmnopqrstuvwxyz0123456789_";
	if (validchars.indexOf(letter) == -1) {
		return false;
		} else {
		return true;
		}
	}

function flashFixWrite (src) {
	document.write(src);
	}

function FlashFixAll() {
	ieupdate();
	// if ( navigator.appVersion.indexOf("MSIE")!=-1 ) {
		// theObjects = document.getElementsByTagName("object");
		// for (var i = 0; i < theObjects.length; i++) {
			// theObjects[i].outerHTML = theObjects[i].outerHTML;
			// }
		// }
	}	

function ieupdate(){ 
	var strBrowser = navigator.userAgent.toLowerCase(); 
	if(strBrowser.indexOf("msie") > -1 && strBrowser.indexOf("mac") < 0){  
		var theObjects = document.getElementsByTagName('object');  
		var theObjectsLen = theObjects.length;  
		for (var i = 0; i < theObjectsLen; i++) {   
			if(theObjects[i].outerHTML){    
				if(theObjects[i].data) theObjects[i].removeAttribute('data');   
				var theParams = theObjects[i].getElementsByTagName("param");    
				var theParamsLength = theParams.length;    
				for (var j = 0; j < theParamsLength; j++) {      
					if(theParams[j].name.toLowerCase() == 'flashvars') var theFlashVars = theParams[j].value;
					}    
				var theOuterHTML = theObjects[i].outerHTML;    
				var re = /<param name="FlashVars" value="">/ig;    
				theOuterHTML = theOuterHTML.replace(re,"<param name='FlashVars' value='" + theFlashVars + "'>");
				theObjects[i].outerHTML = theOuterHTML;   
				}  
			} 
		}
	}

window.onunload = function() { 
	if (document.getElementsByTagName) {  
		var objs = document.getElementsByTagName("object");  
		for (i=0; i<objs.length; i++) objs[i].outerHTML = "";   
		}
	}
	
function confirmNhref(text,href) {
	myConfirm=confirm(text);
	if (myConfirm==true) location.href = href;
//	return (myConfirm);
	}

function sDisplay(id) {
	if ( gid(id).style.display == "none" ) {
		gid(id).style.display = "block";	
		} else {
		gid(id).style.display = "none";
		}
	}

function csmlive( strURL , doact ) {
	var xmlHttpReq = false;
	if (window.XMLHttpRequest) {					// Mozilla/Safari
		xmlHttpReq = new XMLHttpRequest();
	//	xmlHttpReq.overrideMimeType("text/xml");
		} else if (window.ActiveXObject) {			// IE
		xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
	xmlHttpReq.open("POST", strURL, true);
	xmlHttpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttpReq.onreadystatechange = function() {
		if (xmlHttpReq.readyState == 4) {
			cme = xmlHttpReq.responseText;
			setTimeout(doact,0);
			}
		}
	xmlHttpReq.send();
	}

function myReplace(checkMe,toberep,repwith) {
    	temp = checkMe;
    	a = 0;
        	for(i = 0; i < checkMe.length; i++){
        		a = temp.indexOf(toberep);
		if (a == -1) break;
		temp = temp.substring(0 , a) + repwith + temp.substring(a + toberep.length);
		}
        	return temp;
	}

function php_urlencode(str) {
	str = myReplace(str,"&","%26");
	str = myReplace(str,"?","%3F");
	str = myReplace(str," ","+");
	return str;
	}

function hideSelects () {	 
	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 showSelects () {	 
	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 AjaxDeleteComments(id) {
	myConfirm=confirm("אתה בטוח שאתה רוצה למחוק תגובה זו?");
	if (myConfirm==true) {
		gid("hidden_comment_"+id).style.display = "none";
		gid("top_comment_"+id).style.display = "none";
		LoadAjaxData("index.php","&dir=app_sites&page=comments&op=delete&id="+id, "");
		}
	}