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

window.onload = function (){
	init();
}

function init() {
	if (!W3CDOM) return;
	var fakeFileUpload = document.createElement('div');
	fakeFileUpload.className = 'fakefile';	
	var inputfile  = document.getElementById("fileinputid");	
	inputfile.className = 'file hidden';
	var clone = fakeFileUpload.cloneNode(true);
	inputfile.parentNode.appendChild(clone);
	inputfile.relatedElement = clone.getElementsByTagName('input')[0];

}

function save()
{
	
	document.execCommand("SaveAs", '1' , "conf.txt");
	
	
}


function end()
{
	//document.getElementById("searchForm").submit();
	document.getElementById("smallconfbutt").click();
	
}


/*function savefile( f ) 
{  
	f = f.elements;  //  reduce overhead   
	var w = window.frames.w;  
	if( !w ) 
	{  
		 w = document.createElement( 'iframe' );   
		 w.id = 'w';   
		 w.style.display = 'none';   
		 document.body.insertBefore( w );   
		 w = window.frames.w;   
			 if( !w ) 
			 {    
			 	w = window.open( '', '_temp', 'width=100,height=100' );    
			 	if( !w ) 
			 	{     
			 		window.alert( 'Sorry, could not create file.' ); 
			 		return false;    
			 	}   
			 }  
	}   
	var d = w.document,   ext = f.ext.options[f.ext.selectedIndex],   name = f.filename.value.replace( '/\//g', '\\' ) + ext.text;   
	d.open( 'text/plain', 'replace' );  
	d.charset = ext.value;  
	if( ext.text==='.txt' ) 
	{  
		 d.write( f.txt.value );   
		 d.close();  
	} else 
	{  //  '.html'   
	d.close();   
	d.body.innerHTML = '\r\n' + f.txt.value + '\r\n';  
	}   
	if( d.execCommand( 'SaveAs', null, name ) ){   window.alert( name + ' has been saved.' );  } else {   window.alert( 'The file has not been saved.\nIs there a problem?' );  }  w.close();  return false;  //  don't submit the form }


*/