
function ow(url,p) {
  /////////////////////////////////////////////////////////////////////
  // Function to open a Textalk Weblisher publication.               //
  // Parameter 'url' is the path to the view file, probably named    //
  // 'view.php'. It may be a local path (../pub/view.php) or a full  //
  // URL (http://my.server.com/view.php).                            //
  // Parameter 'p' MAY be set to the subdirectory of a specific      //
  // publication. If not set, it will show the default publication.  //
  /////////////////////////////////////////////////////////////////////
  var width = screen.availWidth;
  var height = screen.availHeight;
  var fullscreen = false;  // For future use
  var fullurl;
  var opts;
  if (url == '') url = 'view.php';
  fullurl = url;
  if (p != '') fullurl += '?p=' + escape(p);
  opts = 'titlebar=no,toolbar=no,location=no,status=yes';
  opts += ',personalbar=no,resizable=yes,menubar=no,scrollbars=yes';
  opts += ',width=' + width + ',height=' + height;
  opts += ',screenX=0,screenY=0,top=0,left=0';
  if (fullscreen) opts += ',fullscreen=yes';
  w = window.open(fullurl,'_blank',opts);
  w.focus();
  if(w.moveTo) w.moveTo(0, 0);
  if(w.resizeTo) w.resizeTo(width, height);
}

function popUp(URL) {
	
	var day = new Date();
	var id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=300,height=450,left = 550,top = 325');");
}

function ViewLogin()
{
	document.getElementById('tableLogin').style.display = "block";
	document.getElementById('divLoginLink').style.display = "none";
	
}
function ViewLogout()
{
	document.getElementById('tableLogin').style.display = "block";
	document.getElementById('divLogoutLink').style.display = "none";
	
}

function CreateControl(DivID,URL,WIDTH, HEIGHT)
{ 
  var d = document.getElementById(DivID);
  d.innerHTML = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" WIDTH="'+WIDTH+'" HEIGHT="'+HEIGHT+'" id="b"> <PARAM NAME=movie VALUE="'+ URL+'"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="'+URL+'" quality=high bgcolor=#FFFFFF WIDTH="'+WIDTH+'" HEIGHT="'+HEIGHT+'" NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> </EMBED> </OBJECT>';
}
function insertHTML(pre, post, fieldName) {
	var field = document.forms[0][fieldName];
	
	if(field == null)
		return;
		
	var range = document.selection.createRange();
	if(!field.contains(range.parentElement()))
		return;
	
	if(range.text != "")
		range.text = pre + range.text + post;
}

function Message_Delete(messageId) {
	if(confirm("Vill du ta bort detta meddelande?"))
		location.href = "Inbox_DeleteMessage.aspx?mid=" + messageId;
}

function Interest_Open(objectId, objectType) {
	var winInterest = window.open("Interest.aspx?" + 
		((objectType == "School") ? "sid" : "cid") +
		"=" + objectId,"winInterest","width=550,height=350,scrollbars=yes");
	winInterest.focus();
}

function browseRepository(field) {
	var repository = window.open(
		"Folders.aspx?field=" + field,
		"repository",
		"width=720,height=350,scrollbars=yes,resizable=yes,status=yes");
	repository.focus();
}

function SubmitOnEnter(e,id)
{
		var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
				
		
		if (keyCode == 13)
		{   
		//alert(id);
		//document.getElementById(id).submit();
			__doPostBack(id,'');
			
		}			
}

/* IE flash-fix */ 
function writeFlashBanner(id,src) {
  			
          document.getElementById(id).innerHTML = "<object data=\""+ src +"\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" type=\"application/x-shockwave-flash\" width='150' height='60' VIEWASTEXT><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='" + src +"' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='" + src +"' quality='high' bgcolor='#ffffff' width='150' height='60' name='mymovie' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
   
 }




