// New Cliqon Javascript Routines
$(document).ready(function(){
	$.scriptPath='includes/jquery/';jQuery.require(['jquery.ui/ui.js','jquery.popupWindow.js','jquery.form.js','jquery.field.min.js', 'jquery.indexer.js', 'jquery.printarea.js', 'jquery.cluetip.js','jquery.footer.min.js', 'jquery.cookie.min.js']);	
	
	$("#open_help").bind("click",function(){var strtitle=$(this).attr("title");var w=500;var ww=document.body.clientWidth;var wl=ww-w;wl=(wl/2);$("#popup").dialog({bgiframe:true,modal:false,autoOpen:false,width:w,resizeable:true,title:strtitle,position:[wl,60]});$("#popup").load('includes/getstrref.php?langcd=' + jlcd + '&strref=help_content');$("#popup").dialog('open')});	
	
	$("#admin_login").bind("click",function(){var strtitle=$(this).attr("rel");var w=260;var ww=document.body.clientWidth;var wl=ww-w;wl=(wl/2);$("#popup").dialog({bgiframe:true,modal:true,autoOpen:false,width:w,resizeable:false,title:strtitle,position:[wl,60]});	$("#popup").load('includes/adminlogin.php?langcd=' + jlcd );$("#popup").dialog('open')});	
	$('#webpad').bind('click', function() {
		var mypage = 'admin/webpad/index.php?langcd=' + jlcd;
		var myname = 'Webpage_Editor';
		AddPopupSB(mypage,myname,800,600,'center','front');	
	});	
	$('#fileman').bind('click', function() {
		var mypage = 'admin/fileman/filemanager.php?langcd=' + jlcd;
		var myname = 'Filemanager';
		AddPopupSB(mypage,myname,910,615,'center','front');	
	});	
	$('#strings').bind('click', function() {
		var mypage = 'admin/index.php?langcd=' + jlcd;
		var myname = 'Administration';
		$.cookie("clq_FILTER", null); $.cookie("clq_PDATA", null); $.cookie("clq_LOCNSTR", null);
		AddPopupSB(mypage,myname,600,600,'center','front');	
	});
	$('.print_thisdiv').click('bind', function() {$("#" + $(this).attr('rel')).printArea();});	
	
	$('.tips').cluetip({
   		splitTitle: '|', 	// use the invoking element's title attribute to populate the clueTip...
                     		// ...and split the contents into separate divs where there is a "|"
    	showTitle: false 	// hide the clueTip's heading
  	});	
	
	// $('#footer').footer();
	
	window.onscroll=function(){if(window.XMLHttpRequest){if(document.documentElement.scrollTop>10||self.pageYOffset>10){$('#fixeddiv').css('position','fixed');$('#fixeddiv').css('top','10px')}else if(document.documentElement.scrollTop<10||self.pageYOffset<10){$('#fixeddiv').css('position','absolute');$('#fixeddiv').css('top','10px')}}}	
	
});

// Function to Redirect Page
function ReDirect(URLStr) {location = URLStr; };

// Standard Popup Window without Scroll Bars
var AddPopupWindow=null;
function AddPopup(mypage,myname,w,h,pos,infocus){
	if(pos=='random'){
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=='center'){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!='center' && pos!='random') || pos==null){LeftPosition=100;TopPosition=100;}settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' +
LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=yes';
	AddPopupWindow=window.open('',myname,settings);
	if(infocus=='front'){AddPopupWindow.focus();AddPopupWindow.location = mypage;}
};

// Opens a print popup window
var PrintPopupWindow=null;
function PrintPopup(mypage,myname,w,h,pos,infocus){
	if(pos=='random'){
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=='center'){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!='center' && pos!='random') || pos==null){LeftPosition=100;TopPosition=100;}settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=yes,toolbar=no,status=no,scrollbars=yes,resizable=yes,dependent=yes,titlebar=no';
	PrintPopupWindow=window.open('',myname,settings);
	if(infocus=='front'){PrintPopupWindow.focus();PrintPopupWindow.location = mypage;}
};

// Opens a print popup window with Scroll Bars
var AddPopupWindowSB=null;
function AddPopupSB(mypage,myname,w,h,pos,infocus){
	if(pos=='random'){
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=='center'){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!='center' && pos!='random') || pos==null){LeftPosition=100;TopPosition=100;}settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' +
LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,dependent=yes';
	AddPopupWindowSB=window.open('',myname,settings);
	if(infocus=='front'){AddPopupWindowSB.focus();AddPopupWindowSB.location = mypage;}
};
