// JavaScript Document
function checkChangeLook(form)
{
		var fouten = "The following error(s) were found:\n\n";
		var fout = false;
		var fckComment = FCKeditorAPI.GetInstance('comment');
	
	if (form.title.value == "")
  	{
	   fout = true;
	   fouten = fouten + "The title is missing\n";
    	}
    
	if (form.category.value == 0)
	{
	   fout = true;
	   fouten = fouten + "Please select a category\n";
    	}
    	
	if (form.Image.value == "" && form.test_img.value.toString().length <= 0)
	{
	   fout = true;
	   fouten = fouten + "The image is missing\n";
    	}
    	

    	
	if (fout)
		alert(fouten);
	else
		form.submit();
		
		
}
    


function checkChangeLookFrontEnd(form)
{
		var fouten = "The following error(s) were found:\n\n";
		var fout = false;

	
	if (form.title.value == "")
  	{
	   fout = true;
	   fouten = fouten + "The title is missing\n";
    	}
    
	if (form.category.value == 0)
	{
	   fout = true;
	   fouten = fouten + "Please select a category\n";
    	}
    	
	if (form.test_img.value.toString().length <= 0) {
	   if (form.Image.value == "")
		{
		   fout = true;
		   fouten = fouten + "The image is missing\n";
		}
	}
    	

    	
	if (fout)
		alert(fouten);
	else
		form.submit();
		
		
}



function checkChangeLookComment(form)
{
		var fouten = "The following error(s) were found:\n\n";
		var fout = false;
		var fckComment = FCKeditorAPI.GetInstance('comment');
	
  	if (fckComment.GetHTML() == "<br type=\"_moz\" />")
  	{
        fout = true;
        fouten = fouten + "The comment is missing\n";	   
    }
    	
    	
	if (fout)
		alert(fouten);
	else
		form.submit();
		
		
}



function checkChangeLookCommentFrontEnd(form)
{
		var fouten = "The following error(s) were found:\n\n";
		var fout = false;
	
	if (form.comment.value == "")
  	{
	   fout = true;
	   fouten = fouten + "The comment is missing\n";
    	}
    	
	if (fout)
		alert(fouten);
	else
		form.submit();
		
		
}





var W3CDOM = (document.createElement && document.getElementsByTagName);

function initFileUploads()
{
	if (!W3CDOM) return;
	var fakeFileUpload = document.createElement('div');
	fakeFileUpload.className = 'fakefile';
	var inP = document.createElement('input');
	inP.className = 'fakeFileButton';
	fakeFileUpload.appendChild(inP);
	var image = document.createElement('img');
	image.src='img/btn_browse.gif';
	fakeFileUpload.appendChild(image);
	var x = document.getElementsByTagName('input');
	for (var i=0;i<x.length;i++) {
		if (x[i].type != 'file') continue;
		if (x[i].parentNode.className != 'fileinputs') continue;
		x[i].className = 'file hidden';
		var clone = fakeFileUpload.cloneNode(true);
		x[i].parentNode.appendChild(clone);
		x[i].relatedElement = clone.getElementsByTagName('input')[0];
		x[i].relatedElement.size = '35';
		x[i].onchange = x[i].onmouseout = function () {
			this.relatedElement.value = this.value;
		}
	}
}

