


jQuery(function() {

	var edit_id;
	
	$('.edit_button').click(function() {

	
		if ($('#form').is(':hidden')) {
			$('#form').show();
		}

		var s = this.id;
		var t = s.split('_');

		var i = t[1];

		edit_id = i;

		var target = '#edit_'+i;
		
		var path = $(target).parent().siblings(':eq(1)').text();
		var title = $(target).parent().siblings(':eq(2)').text();
		var style = $(target).parent().siblings(':eq(3)').text();
		
		$('#editing').text($(target).parent().siblings(':eq(0)').text());

		$('#media_title').val(title);
		$('#media_style').val(style);


		
	});


	$('.del_button').click(function() {
	
		var s = this.id;
		var t = s.split('_');
		var i = t[1];
		edit_id = i;
		var target = '#edit_'+i;

		var title = $(target).parent().siblings(':eq(2)').text();

		if (title.length < 1) { return; }

		if (confirm('Delete ' + title)) {

			$.get('edit.php?type=del&edit_id='+edit_id, function() {				
				document.location = 'index.php';
			});			
		}

	});


	$('#edit_form').submit(function() {
		if (edit_id == undefined) { return; }
		this.action = 'edit.php?edit_id='+edit_id;

	});


	
	
	
	
	
	$('.demo_button').click(function() {

		$('#demo_div').show();
		$('#contact_div').hide();

		$('#name').css('top', '520px');

	});



	$('#conmid').click(function() {
		
		$('#address').slideDown();
		
		$('#player').slideUp();
		
	});
	
	$('#cmid').click(function() {
	
		$('#player').slideDown();
		
		$('#address').slideUp();
	
	});

	
});


function hei() {

/*
	var rawh = document.documentElement.clientHeight;
	var boxh=718;
	alert(rawh+ ' : ' +boxh);
	if (rawh>boxh) {
		var fh = (rawh-boxh)/2;
	}
	$('#out').css('margin-top', fh);
*/

 var rwidth = 0, rheight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	var rwidth = window.innerWidth;
	var rheight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	rwidth = document.documentElement.clientWidth;
	rheight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	rwidth = document.body.clientWidth;
	rheight = document.body.clientHeight;
	}
	
	var boxh = 718;
	
	if (rheight>boxh) {
		var fh = (rheight-boxh)/2;
	}
	
	$('#out').css('margin-top',fh);

}







