var THE_PAGE_IS_LOADED=false;
if(navigator.userAgent.match(/MSIE.*Mac/)){
 Array.prototype.push=function(str_value){
 this[this.length]=str_value;
}
}
var ONLOAD_FUNCTIONS=new Array();
function Goto(form_name,tmpl,pairs_to_set)
{
 var form=document.forms[form_name];
 form.template.value=tmpl;
if(typeof(form.news_id)!='undefined')form.news_id.value='';
if(typeof(pairs_to_set)!='undefined'){
 var array=pairs_to_set.split('&');
 for(var i=0;i < array.length;i++){
 var pair=array[i].split('=');
 var obj=eval('form.'+pair[0]);
 if(typeof(obj)!='undefined'){
 obj.value=pair[1];
}
}
}
if(form.action.indexOf("javascript:Goto")!=-1){
 form.action=tmpl;
}
form.submit();
}
function GotoEx(window_obj,form_name,tmpl)
{
 window_obj.Goto(form_name,tmpl);
}
function Trim(str)
{
 str=str.replace(/^\s*/, "");
 str=str.replace(/\s*$/, "");
return str;
}
function IsValidInteger(str)
{
 str=Trim(str);
 return str.length > 0&&IsValid(str,'0123456789-');
}
function IsValidNatural(str)
{
 str=Trim(str);
 return str.length > 0&&str.indexOf('0')!=0&&IsValid(str,'1234567890');
}
function IsValidReal(str)
{
 str=Trim(str);
 return str.length > 0&&IsValid(str,'0123456789.-');
}
function IsValid(str,alphabet)
{
 for(var i=0;i < str.length;i++){
 if(alphabet.indexOf(str.charAt(i))==-1)return false;
}
return true;
}
function IsValidIdentifier(str)
{
 str=Trim(str);
 return IsValid(str,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890-_');
}
function IsValidEmail(strEmail)
{
 var validEmailRegExp=/^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]+)(\.[a-z]{2,6}(\.[a-z]{2}){0,2})$/i;
 return validEmailRegExp.test(strEmail);
}
function SKPopup(url,width,height,options)
{
 SKPopupHandle(url,width,height,options);
}
function SKPopupHandle(url,width,height,options)
{
 var left=screen.width/2-width/2;
 var top=screen.height/2-height/2;
 var name='OpenedPopupWindow'+width+height;
 var resizable="yes";
 var scrollbars="yes";
 var status="no";
 var toolbar="no";
 var menubar="no";
 var modal="no";
if(typeof(options)!='undefined'){
 if(typeof(options['resizable'])!='undefined')
 resizable=options['resizable'];
if(typeof(options['scrollbars'])!='undefined')
 scrollbars=options['scrollbars'];
if(typeof(options['left'])!='undefined')
 left=options['left'];
if(typeof(options['top'])!='undefined')
 top=options['top'];
if(typeof(options['name'])!='undefined')
 name=options['name'];
if(typeof(options['status'])!='undefined')
 status=options['status'];
if(typeof(options['toolbar'])!='undefined'){
 toolbar=options['toolbar'];
}
if(typeof(options['modal'])!='undefined'){
 modal=options['modal'];
}
if(typeof(options['menubar'])!='undefined'){
 menubar=options['menubar'];
}
}
var options='left='+left+
 ',top='+top+
 ',width='+width+
 ',height='+height+
 ',resizable='+resizable+
 ',scrollbars='+scrollbars+
 ',toolbar='+toolbar+
 ',menubar='+menubar+
 ',modal='+modal+
 ',status='+status;
 var handle=window.open(url,name,options);
if(handle)
 handle.focus();
 else
 AlertSystemMessage(
 "Please, enable pop-ups!\n"+
 "Pop-up blocking is activated in your browser settings or a pop-up blocker installed on your computer. To be able to administrate your SiteKreator website, please enable pop-ups for sitekreator.com by following the instructions here: http://sitekreator.com/sitekreator/FAQaccounts.html#q15"
);
 return handle;
}
function AreCookiesEnabled()
{
 var test_cookie_string="TestingIfCookiesAreEnabled=TestValue";
 document.cookie=test_cookie_string;
 if(document.cookie.indexOf(test_cookie_string)==-1){
 return false;
}
 document.cookie=test_cookie_string+'Expires: '+"; expires=Thu, 01-Jan-70 00:00:01 GMT";
 return true;
}
function AlertNotEnabledCookiesMessage()
{
 AlertSystemMessage(
 "Please, enable cookies!\n"+
 "Session cookies are not allowed in your browser settings. To be able to administrate your SiteKreator website, please allow cookies by following the instructions here: http://sitekreator.com/sitekreator/FAQaccounts.html#q13"
);
}
function AlertSystemMessage(message)
{
 alert(message);
}
function RefreshCachedImages()
{
}
function LoginToEdit(login,login_page,template_path)
{
 var options=new Array();
 options['resizable']='no';
 options['scrollbars']='no';
SKPopup(login_page+'?template_path='+escape(template_path)+
 '&domain='+document.location.host+
 '&login='+login,300,200,options);
}
function Logout(page_been_published,login_cookie_name,admin_part)
{
 var url=document.location.href;
 var begin=url.indexOf('?');
if(begin!=-1)
 url=url.substring(0,begin);
url=url.replace( admin_part, "" );
 var eua_page=url;
 if(!page_been_published)
 eua_page='http://'+document.location.hostname+'/index.html';
if(login_cookie_name!=''){
 DeleteCookie(login_cookie_name,"/");
}
top.location.href=eua_page;
}
function ExecuteOnLoadFunctions()
{
 THE_PAGE_IS_LOADED=true;
for(var i=0;i < ONLOAD_FUNCTIONS.length;i++){
 eval(ONLOAD_FUNCTIONS[i]);
}
}
function IsPageLoaded()
{
 return THE_PAGE_IS_LOADED;
}
function OpenHelp(root_dir)
{
 SKPopup(root_dir+'help_index.html',500,266);
}
function FixURL(url)
{
 url=Trim(url);
 url=url.replace( /\"/g, escape( '"' ));
 url=url.replace( /\'/g, escape( "'" ));
 url=url.replace( / /g, escape( " " ));
if(url.toLowerCase().indexOf('://')==-1&&url.toLowerCase().indexOf('mailto:')!=0){
 if(url.indexOf('@')!=-1&&url.indexOf('.')!=-1){
return 'mailto:'+url;
}else{
 return 'http://'+url;
}
}
return url;
}