// handels some cookies for easier course-copying

/* 

how the first url for the copied course looks like:
<a target="_top" href="http://abu.lernfrage.ch/course/view.php?id=18">Weiter</a>

 <font size="2"><b><a target="_top" href="http://abu.lernfrage.ch/">ABU</a> &raquo; <a href="http://abu.lernfrage.ch/admin/index.php">Administration</a> &raquo;

                      Kurs-Rücksetzung &raquo; dummy-kurs.zip</b></font>



// so get the id if you find this url
if(document.getElementsByTagName){
	
}

*/

function setRestoredCourseId(v){
	storage.put("restoredCourseId", v, statusHandler);
} 

function getRestoredCourseId(){
	return 	storage.get("restoredCourseId");
	

}

function openRestoredCourseLink(link){
	// get the iframe first...
	var url = link + "?id=" + getRestoredCourseId();
	if(document.getElementById("iframe")){
		var iframe = document.getElementById("iframe");
		iframe.src = url;
	} else {
		location.href = url;
	}

}
function statusHandler(status) {
	if (status == Storage.SUCCESS) {
	  var results = storage.get(name);
	  // alert("Results from statusHandler="+results);
	}
	else if (status == Storage.PENDING) {
	  //alert("Results pending approval of storage space from user");
	}
	else if (status == Storage.FAILED) {
	  // alert("Storage request denied");
	}
};



