/* JavaScript library */

/*
function recieveTextFromFlash(txt) {
	alert(txt);
}
*/
$(document).ready(function(){
	
	//Set round corners:
	DD_roundies.addRule('.roundcorners', '10px 0px', false);
	DD_roundies.addRule('.roundcornersall', '10px', false);
	DD_roundies.addRule('.roundcornerssmall', '5px 0px', false);
	
	if (!jQuery.browser.msie) {
	    $("div.inflate").animate({opacity : 0.6}, 400);

		$("div.inflate").mouseenter(function() {
		$(this).stop().animate({
		//marginTop: '-80px',
		//marginLeft: '-80px',
		opacity: 1
		//marginTop: '-=1',
		//marginLeft: '-=1',
		//paddingTop: '+=1',
		//paddingLeft: '+=1',
		//width: '+=2',
		//height: '+=2',
		}, 200)}).mouseleave (function() {
		$(this).stop().animate({
		//marginTop: '0',
		//marginLeft: '0',
		opacity: 0.6
		//marginTop: '+=1',
		//marginLeft: '+=1',
		//paddingTop: '-=1',
		//paddingLeft: '-=1',
		//width: '-=2',
		//height: '-=2',
		}, 200);
		});
	}
});
	
function wait(millis) 
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); } 
while(curDate-date < millis);
} 

/*
function afterimage() {
	//alert('Afterimage');
	//Insert a new uploadfield and fold it out:
	jQuery.post("u_uploadfield.php",
		'',
		function(data){
			if (data.substr(0, 5) == 'FEJL!') {
				alert(data);
			} else {
				var divname = 'divupload_' + Math.floor(Math.random()*10000);
				var newdiv = '<div id="'+divname+'" style="display:none">'+data+'</div>';
				
				var theDiv = document.getElementById('divcurrenttheme');
				theDiv.innerHTML = newdiv + theDiv.innerHTML;
				//Now animate it, but wait a second:
				//wait(500);
				jQuery("#" + divname).slideDown(500);
			}
		},
		"text");
}
*/

/*
function recieveTextFromFlash(txt) {
	var strdata = 'pic_id=' + txt;
	//Show("u_showpicture_ajax.php", strdata);
	window.location.href = 'u_showpicture.php?'+strdata;
}
*/

function trim(str) {
    return str.replace(/^\s+|\s+$/g, "");
};

/*
function confirmDeleteComments() {
	if (confirm("Er du sikker på, at du vil slette denne tråd?")) {
  		document.formDeleteComments.submit();
	}
	return true;
}
*/


function setclass(theclass, frame_scroll_offset) {
	//Set the class of the currently loaded image:
	
	var strdata = 'class='+theclass;
	jQuery.post("u_setclass.php", strdata,
	function(data) {
		if (data.substr(0,2) != 'OK') {
			alert(data);
		} else {	
			jQuery.post("u_uploadfield.php", 'frame_scroll_offset='+frame_scroll_offset,
			function(data) {
				//Reload the image-upload bar:
				var d = document.getElementById('divuploadimg');
				d.innerHTML = data;
				
				//Compile the JavaScript of the newly loaded HTML:
				var x = d.getElementsByTagName("script");   
				for(var i=0;i<x.length;i++)  
				{  
				   eval(x[i].text);  
				} 
			}, "text");
		}	
	}, "text");
	
}


