<!--
 
var sendReq = getXmlHttpRequestObject();
var objResponse;

function GetSize(f)
{
	if (f != null)
	{
		var obj = f;
		return obj.value;
	}
	else
	{
		return '';
	}
}

function getXmlHttpRequestObject() 
{
	if (window.XMLHttpRequest) 
	{
		return new XMLHttpRequest();
	} 
	else if (window.ActiveXObject) 
	{
		return new ActiveXObject("Microsoft.XMLHTTP");
	}		
	else 
	{
		alert('Status: Cound not create XmlHttpRequest Object.  Consider upgrading your browser.');
	}
}

function GetAjaxRSS(id)
{
	
	//var fld = document.getElementById(id);
	//getRSS(fld.value);
}

function getRSS(url) 
{
	if (sendReq.readyState == 4 || sendReq.readyState == 0) 
	{
		sendReq.open("GET",url , true);
		sendReq.onreadystatechange = handleReceiveRSS; 
		sendReq.send(null);
	}	
}

function handleReceiveRSS() 
{
	if (sendReq.readyState == 4) 
	{
		var xmldoc = sendReq.responseText;
		//objResponse.innerHTML = xmldoc	
		alert(xmldoc);		 
	}
}	

function ChangeOperation(id, this_id, desc, htm, operType)
{
	var obj = document.getElementById(id);
	var this_obj = document.getElementById(this_id);
	
	if (this_obj.title == 'update')
	{
		this_obj.value = 'ìçõ ìòãëåï';
		this_obj.title = 'insert';
		document.getElementById("prev").style.display = 'none';
		document.getElementById(desc).value = '';
		document.getElementById(htm).value = '';
		document.getElementById("divTitle").innerHTML = 'äåñôä çãùä';
		
		document.getElementById("span_delete").style.display = 'none';
	}
	else if (this_obj.title == 'insert')
	{
		this_obj.value = 'äåñó òøåõ';
		this_obj.title = 'update';
		document.getElementById("prev").style.display = 'block';
		document.getElementById(desc).value = document.getElementById(desc).title;
		document.getElementById(htm).value = document.getElementById(htm).title;
		document.getElementById("divTitle").innerHTML = 'òãëåï';
		
		document.getElementById("span_delete").style.display = 'block';
	}
	
	document.getElementById(operType).value = this_obj.title;
}

function AddHTMLToEditor(str_html)
{	
	window.opener.insertpic(str_html);
	window.close();
	return true;
}

function GetRSSFeedIntoEditor(url, width, height, flag)
{
	var my_result;
	
	if (width == '' && height == '')
	{
		my_result = url;
	}
	else
	{
		my_result = "<iframe width=" + width + " height=" + height + " style='border:0px;' marginheight='0' src='http://www.2all.co.il/web/rss_bridge.asp?url=" + url + "?format=xml&direction=up&scrollamount=1&scrolldelay=30' marginwidth='0' scrolling='no' frameborder='no' allowtransparency></iframe>";
	}
	
	if (flag == 1)
	{
		AddHTMLToEditor(my_result);
	}
	else
	{
		document.getElementById("prev").style.display = 'block';
		var d = document.getElementById("myDiv");
		d.innerHTML = my_result;
	}  
}

function OpenFilesWindow()
{	
	var w = window.open('UploadFiles.aspx','_self','height=700,width=780,status=yes,toolbar=no,menubar=no,location=no');
}

function GetFilesIntoEditor(tableID, displayOrDownload)
{
	var table_rows = document.getElementById(tableID).rows;
    var my_checkbox;
    var my_result = "<table border='0' cellspacing='0' cellpadding='0'>";
    var fileUrlPath = document.getElementById('hidden_urlPath').value;
    
	for (i = 0; i < table_rows.length; i++) 
    {
		my_checkbox = document.getElementById('checkbox' + (i + 1));
		
        if (my_checkbox.checked) 
        {
			my_result += '<tr>';
			my_result += '<td>';
			
			if ((document.getElementById('hidden_description' + (i + 1)).value != '' && displayOrDownload == '1') || displayOrDownload == '0')
			{	
				my_result += GetHtmlForUploadFiles('', document.getElementById('hidden_extname' + (i + 1)).value, fileUrlPath, document.getElementById('hidden_filename' + (i + 1)).value, '200', '200', displayOrDownload, document.getElementById('hidden_description' + (i + 1)).value);		
			}
			else
			{
				my_result += GetHtmlForUploadFiles('', document.getElementById('hidden_extname' + (i + 1)).value, fileUrlPath, document.getElementById('hidden_filename' + (i + 1)).value, '200', '200', displayOrDownload, document.getElementById('hidden_filename' + (i + 1)).value);
			}
				
			my_result += '</td>';
			my_result += '</tr>';
        }
    }
    
    my_result += '</table>'
    
    AddHTMLToEditor(my_result);
}

function GetHtmlForUploadFiles(targetId, extName, fileUrlPath, fileName, width, height, displayOrDownload, desc)
{
	var targetObj = document.getElementById(targetId);
	var str_result;
	var str_image;
	var str_doc;
	var str_video;
	var str_flash;
	
	var str_pdf;
	var str_tpl;
	var str_mq4;
	var str_ex4;
	
	if (displayOrDownload == '0')
	{
		str_image = "<img src='" + fileUrlPath + fileName + "' width='" + width + "' height='" + height + "' />";
		str_doc = "<a href='" + fileUrlPath + fileName + "'><img src='http://www.2all.co.il/web/images/word_icon.jpg' style='border:1px solid #bbbbbb;' alt='" + fileName + "'/></a>";
		
		str_video = "<embed ";
			str_video += "width='" + width + "' ";  
			str_video += "height='" + height + "' "; 
			str_video += "type='application/x-mplayer2' ";
			str_video += "pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/' ";
			str_video += "src='" + fileUrlPath + fileName + "' ";
			str_video += "autorewind='true' "; 
			str_video += "showdisplay='false' "; 
			str_video += "showstatusbar='false' "; 
			str_video += "showcontrols='true' "; 
			str_video += "autostart='true' ";
			str_video += "filename='" + fileUrlPath + fileName + "' />";
		
		/*
		str_video = "<object id='mediaplayer1' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' standby='Loading Microsoft Windows® Media Player components...' type='application/x-oleobject' width='" + width + "' height='" + height + "'>"; 
			str_video += "<param name='filename' value='" + fileUrlPath + fileName + "'></param>";
			str_video += "<param name='animationatstart' value='true'></param>";
			str_video += "<param name='transparentatstart' value='true'></param>";
			str_video += "<param name='autostart' value='true'></param>";
			str_video += "<param name='showcontrols' value='true'></param>";
			str_video += "<param name='volume' value='70'></param>";
			str_video += "<embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='" + fileUrlPath + fileName + "' name='mediaplayer1' width='" + width + "' height='" + height + "' autostart='1' showcontrols='1' volume='70'></embed>"; 
			str_video += "</object>";
		*/
			
		str_flash = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='" + width + "' height='" + height + "' id='Object1' align='middle' VIEWASTEXT>";
			str_flash += "<param name='allowScriptAccess' value='sameDomain'></param>";
			str_flash += "<param name='movie' value='" + fileUrlPath + fileName + "'></param>";
			str_flash += "<param name='quality' value='high'></param>";
			str_flash += "<param name='bgcolor' value='#ffffff'></param>";
			str_flash += "<embed src='" + fileUrlPath + fileName + "' quality='high' bgcolor='#ffffff' width='" + width + "' height='" + height + "' name='2allBtns' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed>"; 
			str_flash += "</object>";
			
			str_pdf = "<a href='" + fileUrlPath + fileName + "'><img src='http://www.2all.co.il/web/images/file_icon.jpg' style='border:1px solid #bbbbbb;' alt='" + fileName + "'/></a>";
			str_tpl = "<a href='" + fileUrlPath + fileName + "'><img src='http://www.2all.co.il/web/images/file_icon.jpg' style='border:1px solid #bbbbbb;' alt='" + fileName + "'/></a>";
			str_mq4 = "<a href='" + fileUrlPath + fileName + "'><img src='http://www.2all.co.il/web/images/file_icon.jpg' style='border:1px solid #bbbbbb;' alt='" + fileName + "'/></a>";
			str_ex4 = "<a href='" + fileUrlPath + fileName + "'><img src='http://www.2all.co.il/web/images/file_icon.jpg' style='border:1px solid #bbbbbb;' alt='" + fileName + "'/></a>";
	}
	else
	{
		str_image = "<a href='" + fileUrlPath + fileName + "' target='_blank' title='" + desc + "'>" + desc + "</a>";
		str_doc = "<a href='" + fileUrlPath + fileName + "' target='_blank' title='" + desc + "'>" + desc + "</a>";
		str_video = "<a href='" + fileUrlPath + fileName + "' target='_blank' title='" + desc + "'>" + desc + "</a>";
		str_flash = "<a href='" + fileUrlPath + fileName + "' target='_blank' title='" + desc + "'>" + desc + "</a>";
		
		str_pdf = "<a href='" + fileUrlPath + fileName + "' target='_blank' title='" + desc + "'>" + desc + "</a>";
		str_tpl = "<a href='" + fileUrlPath + fileName + "' target='_blank' title='" + desc + "'>" + desc + "</a>";
		str_mq4 = "<a href='" + fileUrlPath + fileName + "' target='_blank' title='" + desc + "'>" + desc + "</a>";
		str_ex4 = "<a href='" + fileUrlPath + fileName + "' target='_blank' title='" + desc + "'>" + desc + "</a>";
	}

	switch (extName)
	{
		case ".swf":
			
			str_result = str_flash;
			break;
			
		case ".gif":
		
			str_result = str_image;
			break;
			
		case ".jpg":
		
			str_result = str_image;
			break;
			
		case ".bmp":
		
			str_result = str_image;
			break;
			
		case ".doc":
		
			str_result = str_doc;
			break;
			
		case ".docx":
		
			str_result = str_doc;
			break;
				
		case ".mp3":
		
			str_result = str_video;
			break;
			
		case ".avi":
		
			str_result = str_video;
			break;
		
		case ".wma":
		
			str_result = str_video;
			break;
		
		case ".pdf":
		
			str_result = str_pdf;
			break;
			
		case ".tpl":
		
			str_result = str_tpl;
			break;
			
		case ".mq4":
		
			str_result = str_mq4;
			break;
			
		case ".ex4":
		
			str_result = str_ex4;
			break;
			
		default:
			str_result =  "<a href='" + fileUrlPath + fileName + "' target='_blank' title='" + desc + "'>" + desc + "</a>";
			break;			
	}
	
	if (targetId != '')
	{
		var obj = document.getElementById(targetId);
		obj.innerHTML = str_result + "<br /><input type='text' value='" + fileUrlPath + fileName + "'>";
	}
	
	return str_result;
}

-->
