function img_placeholder(id, photo, url) {
	window.open("/placeholder.php?ID=" + id + "&Photo=" + photo + "&Url=" + url , "placeholder_img", "width=25,height=25,left=0,top=0,toolbar=no,status=yes,location=no,menubar=no,resizeable=no,scrollbars=no");
}

function album_stok_mynd(album, file, url) {
	popwin = window.open("/upload.stk_mynd.php?PHOTO_ALBUM=" + album + "&PHOTO_FILE=" + file + "&CMS_URL=" + url, "stk_mynd","width=550,height=350,left=0,top=0,toolbar=no,status=yes,location=no,menubar=no,resizeable=no,scrollbars=yes");
	popwin.moveTo((screen.width/2)-550/2,(screen.height/2)-350/2);


}

function login(ab) {
	
	popwin = window.open("/stjorn/innskraning.php?Url=" + ab, "innskraning", "width=300,height=210,left=0,top=0,toolbar=no,status=yes,location=no,menubar=no,resizeable=no,scrollbars=yes");
	popwin.moveTo((screen.width/2)-300/2,(screen.height/2)-210/2);
	
}

function log_out(ab) {


	popwin = window.open("/stjorn/utskraning.php?Url=" + ab, "utskraning", "width=200,height=150,left=0,top=0,toolbar=no,status=yes,location=no,menubar=no,resizeable=no,scrollbars=yes");
	popwin.moveTo((screen.width/2)-200/2,(screen.height/2)-150/2);	
	
}

function eyda_faerslu(id, type, category) {
	var answer = confirm("Viltu eyða færsluna?")
	if (answer){
		window.open("/autonomy_files/system/delete.item.php?CMS_TYPE=" + type + "&CMS_CAT=" + category + "&CMS_ID=" + id, "delete","width=25,height=25,left=0,top=0,toolbar=0,status=0,");
		
	}
}

function album_ftp(id, url) {
	var answer = confirm("Færa myndir af FTPnum yfir í albúmið?")
	if (answer){
		window.open("/img.php?CMS_ALBUM_ID=" + id + "&CMS_URL=" + url, "ftp_upload","width=300,height=350,left=0,top=0,toolbar=0,status=0,");
		popwin.moveTo((screen.width/2)-300/2,(screen.height/2)-350/2);
	}
}


function album_stok_mynd(album, file, url) {
	popwin = window.open("/autonomy_files/system/pictures/upload.stk_mynd.php?PHOTO_ALBUM=" + album + "&PHOTO_FILE=" + file + "&CMS_URL=" + url, "stk_mynd","width=550,height=350,left=0,top=0,toolbar=no,status=yes,location=no,menubar=no,resizeable=no,scrollbars=yes");
	popwin.moveTo((screen.width/2)-550/2,(screen.height/2)-350/2);
}


var globalCursorPos; // global variabe to keep track of where the cursor was

//sets the global variable to keep track of the cursor position
function setCursorPos() {
  globalCursorPos = getCursorPos(myForm.myTextArea);
}

//This function returns the index of the cursor location in
//the value of the input text element
//It is important to make sure that the sWeirdString variable contains
//a set of characters that will not be encountered normally in your
//text
function getCursorPos(textElement) {
  //save off the current value to restore it later,
  var sOldText = textElement.value;


//create a range object and save off it's text
  var objRange = document.selection.createRange();
  var sOldRange = objRange.text;

//set this string to a small string that will not normally be 
encountered
  var sWeirdString = '#%~';

//insert the weirdstring where the cursor is at
  objRange.text = sOldRange + sWeirdString; objRange.moveStart
('character', (0 - sOldRange.length - sWeirdString.length));

//save off the new string with the weirdstring in it
  var sNewText = textElement.value;

//set the actual text value back to how it was
  objRange.text = sOldRange;

//look through the new string we saved off and find the location of
//the weirdstring that was inserted and return that value
  for (i=0; i <= sNewText.length; i++) {
    var sTemp = sNewText.substring(i, i + sWeirdString.length);
    if (sTemp == sWeirdString) {
      var cursorPos = (i - sOldRange.length);
      return cursorPos;
    }
  }
}

//this function inserts the input string into the textarea
//where the cursor was at
function insertString(stringToInsert) {
  var firstPart = myForm.myTextArea.value.substring(0, globalCursorPos);
  var secondPart = myForm.myTextArea.value.substring(globalCursorPos,
                                                     
myForm.myTextArea.value.length);
  myForm.myTextArea.value = firstPart + stringToInsert + secondPart;
}