// 	MAIN JS FUNCTIONS
//	BY NICOLAS PIRSON FOR TATACTIC.BE
//	IF YOU WANS TO USE THE SCRIPT ON THIS SITE PLEASE LET
//	THOSE LINES IN COMMENT. THANK YOU.
//	PROVIDED BY Nicolas Pirson (http://tatactic.be)
searchSite = function(){
	var searchlocation=document.getElementById("termsToSearch").value;
	var locationSearch = document.getElementById("location1").checked;
	var debugstr = searchlocation + " " + locationSearch;
	var qwry="";
	if(locationSearch){
		qwry = "http://www.google.com/search?hl=fr&q=site:tatactic.be+" +  document.getElementById("termsToSearch").value;
	}else{
		qwry = "http://www.google.com/search?hl=fr&q=" +  document.getElementById("termsToSearch").value;
	}
	//location.href=qwry;
	var win = window.open(qwry, '_blank', 'status=yes,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes');
	//window.open(qwry,"search page",null,null);void(0);
}
searchstudy = function(){
	var searchlocation=document.getElementById("substanceName").value;
	var qwry="http://www.clinicaltrials.gov/ct2/results?term=" + searchlocation;
	//location.href=qwry;
	var win = window.open(qwry, '_blank', 'status=yes,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes');
	//window.open(qwry,"search page",null,null);void(0);
}
translateInSite = function(){
	var qwry = "http://translate.google.com/translate?hl=+" +  document.getElementById("sourceLang").value;
	qwry += "&sl=" + document.getElementById("sourceLang").value +"&tl=" + document.getElementById("destinationLang").value+"&u="+document.location;
	//location.href=qwry;
	var win = window.open(qwry, '_blank', 'status=yes,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes');
	//window.open(qwry,"search page",null,null);void(0);
}
testSiteOnW3c = function(){
	var qwry = "http://validator.w3.org/check?uri=" +  escape(document.getElementById("urlToValidate").value);
	var win = window.open(qwry, '_blank', 'status=yes,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes');
	//window.open(qwry,"search page",null,null);void(0);
}
openImage = function(imageURL){
	var qwry = imageURL;
	var win = window.open(qwry, '_blank', 'height=800,width=950,status=yes,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes');
}

openPopupImage = function(imageURL,width,height){
	var qwry = imageURL;
	var title = "HVA HVB HVC HVD (http://tatactic.be PICTURE POPUP)";
	var win = window.open('','win', 'height=' + height + ',width=' + width + ',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
	win.document.open();
	win.document.write("<head>");
	win.document.write("<title>");
	win.document.write(title);
	win.document.write("</title>");
	win.document.write('<style type="text/css">');
	win.document.write('body {');
	win.document.write('margin-left: 0px;');
	win.document.write('margin-top: 0px;');
	win.document.write('margin-right: 0px;');
	win.document.write('margin-bottom: 0px;');
	win.document.write('padding-left: 0px;');
	win.document.write('padding-top: 0px;');
	win.document.write('padding-right: 0px;');
	win.document.write('padding-bottom: 0px;');
	win.document.write('background:#000;');
	win.document.write('}');
	win.document.write('</style>') ;
	win.document.write("</head>");
	win.document.write("<img src='"+qwry+"' width='"+width+"' height='"+height+"'>");
	win.document.close();
	var clientw=screen.availWidth;
	var clienth=screen.availHeight;
	win.moveTo((clientw-width)/2,(clienth-height)/2);
	//win.focus()
}
openPopupWin = function(pageURL,width,height,titlePara){
	var qwry = pageURL;
	var title = titlePara;
	var win = window.open(qwry, 'title', 'height=' + height + ',width=' + width + ',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
	var clientw=screen.availWidth;
	var clienth=screen.availHeight;
	win.moveTo((clientw-width)/2,(clienth-height)/2);
	//win.focus()
}
openNewWin = function(theURL){
	var qwry = theURL;
	var win = window.open(qwry, '_blank', 'height=800,width=1100,status=yes,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes');
	//win.focus();
}
openWin = function(theURL){
	qwry = theURL;
	
	var win = window.open(qwry, '_blank', 'height=800,width=1100,status=yes,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes');
	//win.focus();
}
avertissementFunction = function(avertissementMsg,chockingContentURL){
	/*
	HOW TO USE SAMPLE BY NICOLAS PIRSON FOR BLOGSPOT.TATACTIC.BE:
	<a href="javascript:avertissementFunction('attention contenu choquant','http://www.youtube.com/watch?v=89gNe8cXib4');" target="_self">TEST CONFIRM TEXT HERE!</a>
	*/
	var confirmResponseUser = confirm(avertissementMsg);
	if(confirmResponseUser != true){
		return iDisagree();
	}else{
		return iAgree(chockingContentURL);
	};
}
	
iAgree=function(currentChockingContentURL){
	openNewWin(currentChockingContentURL);
}

iDisagree = function(){
	void(null);
}