/*
 ********************************Functii de biblioteca***************************************
 */

var ns  = (document.layers)? true:false; 
var ie4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true:false;
var ie5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true:false;
var ie6 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 6.")!=-1)) ? true:false;
var ie = ie4 || ie5 || ie6;
var dom = (document.getElementById) ? true:false;
var splashWin = null;


var Months=new Array("ian","feb","mar","apr","may","iun","iul","aug","sep","oct","nov","dec");
var Days  =new Array("sunday","monday","tuesday","wendesday","thursday","friday","saturday");


var numb = '0123456789';
var lwr = 'abcdefghijklmnopqrstuvwxyz';
var upr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var spc =",._@$%()[]{};<>/ !-:'?*";
var win=null;


computergames_content = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'computergamestable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download computer wallpapers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>computer wallpapers games. tomb raider, stronghold, spiderman, serious sam, renegade, redalert2, mortal kombat, morowind, medal of honor, max payne, half-life, grand tourismo, ghotic, counter strike, colin mcrae rally, battle realms, battle for dune, aquanox, alien ressurection, alien crossfire</h4></td></tr></table>";
digital_content       = "<table border='0' width='270' class='newstable' cellpadding='1' cellspacing='1' id= 'digitaltable'><tr><td  height='25' width='25' align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td align='left' width='100%'><span class='smallblackcaption'>download wallpaper digital 3d</span></td></tr><tr><td height='30' colspan='2' class='newsheader'><h4>3DataDesign, Angular Vision, 3d construction, 3d human, 3d vechicles, 3d landscape, ocean 3d, more...</h4></td></tr></table>";
city_content          = "<table border='0' width='250' class='newstable' cellpadding='1' cellspacing='1' id= 'citytable'><tr><td  align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download  wallpaper city &amp; bridges</span></td></tr><tr><td  colspan='2' class='newsheader'><h4>Golden Gate, London, Tower Bridge, San Francisco, New York, Sidney, apeducts, country bridges, more...</h4></td></tr></table>";
desktop_content       = "<table border='0' width='200' class='newstable' cellpadding='1' cellspacing='1' id= 'desktoptable'><tr><td  align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper desktop</span></td></tr><tr><td  colspan='2' class='newsheader'><h4>replace your desktop computer with one of these classic desktop wallpapers ...</h4></td></tr></table>";
erotic_content        = "<table border='0' width='190'  class='newstable' cellpadding='1' cellspacing='1' id= 'erotictable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper erotic</span></td></tr><tr><td  colspan='2' class='newsheader'><h4>hot bikini with content and attitude !</h4></td></tr></table>";
fantasy_content       = "<table border='0' width='220' class='newstable' cellpadding='1' cellspacing='1' id= 'fantasytable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper fantasy</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Vallejo, Parkinson, Frazier, Whelan, dragons, Royo, more...</h4></td></tr></table>";
movies_content        = "<table border='0' width='250' class='newstable' cellpadding='1' cellspacing='1' id= 'moviestable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper movies</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Alien, Alien vs. predator, Matrix, Star Wars, Pearl Harbour, Final Fantasy, Jurassic Park, Harry Potter, Independence Day, Highlander, Tiger and Dragon, Titanic, Blade Runner, A beautiful mind, Lord of the Ring </h4></td></tr></table>";
flowers_content       = "<table border='0' width='200' class='newstable' cellpadding='1' cellspacing='1' id= 'flowerstable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper flowers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>All seasons flowers, all kind of shapes, colors, sizes...</h4></td></tr></table>";
cars_content          = "<table border='0' width='200'  class='newstable' cellpadding='1' cellspacing='1' id= 'carstable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper cars</span></td></tr><tr><td colspan='2' class='newsheader'><h4>BMW, Ferrari, Porsche, Mercedes, Lotus, Aston Martin, Rolls Royce, sport cars, de luxe cars, more...</h4></td></tr></table>";
animals_content       = "<table border='0' width='250'  class='newstable' cellpadding='1' cellspacing='1' id= 'animalstable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper animals &amp; insects</span></td></tr><tr><td colspan='2' class='newsheader'><h4>wild and pets, african animals, tigers, bears, crocodiles, close-up insects, lots of them...</h4></td></tr></table>";
water_content         = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'watertable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper water &amp; waterfalls</span></td></tr><tr><td colspan='2' class='newsheader'><h4>water and waterfalls, rain forest springs, lakes, rivers... wet wallpapers !</h4></td></tr></table>";
space_content         = "<table border='0' width='200' class='newstable' cellpadding='1' cellspacing='1' id= 'spacetable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper space</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Astronauts, Earth, Moon, Planets, Lift off, Distant galaxies...</h4></td></tr></table>";
landscape_content     = "<table border='0' width='320' class='newstable' cellpadding='1' cellspacing='1' id= 'landscapetable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper ocean &amp; sunsets</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Beautiful views, ocean, sunsets, dream landscapes, at least enjoy viewing them,  if you're not there !</h4></td></tr></table>";
forest_content        = "<table border='0' width='220' class='newstable' cellpadding='1' cellspacing='1' id= 'foresttable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper forests</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Deep rain forest images, trees and close-up leaves, sunrays, fog, myst, all greenland mistery... </h4></td></tr></table>";
music_content         = "<table border='0' width='250' class='newstable' cellpadding='1' cellspacing='1' id= 'musictable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper big music</span></td></tr><tr><td colspan='2' class='newsheader'><h4>The Offspring, Gorillaz, Fiona Apple, Shirley Manson, David Bowie, Andrea Corr, Beatles, Nirvana, Celine Dion, KISS, Faith Hill, Ricky Martin, Sting, Santana, Eminem, Iron Maiden, Bjork, Dream Theater, Led Zeppelin, Pink Floyd, Alanis, Aerosmith, AC DC</h4></td></tr></table>";
comics_content        = "<table border='0' width='200' class='newstable' cellpadding='1' cellspacing='1' id= 'comicstable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper comics</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Superman, Spawn, Blade, Batman, Witchblade, Xmen, Wolverine, Catwoman, Spiderman, Storm, Danger Girl</h4></td></tr></table>";
fine_art_content      = "<table border='0' width='200' class='newstable' cellpadding='1' cellspacing='1' id= 'fine_arttable'><tr><td align='center'><img name='exclam'  src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper fine art</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Escher, Matisse, Picasso, Salvador Dali, van Gogh, da Vinci...</h4></td></tr></table>";
sports_content        = "<table border='0' width='250' class='newstable' cellpadding='1' cellspacing='1' id= 'sportstable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper sports</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Atlanta Hawks, Baseball, Basketball, Ciclism, Climbing, David Beckham, Del Piero, Detroit Pistons, Golf, Hernan Crespo, Maria Sharapova, Martina Hingis, Miami Heat, Milan Baros, Orlando Magic, Owen, Pittsburgh Steelers, Roger Federer, Ronaldinho, Ronaldo, Rugby, Shevchenko, Soccer, Surf, Tennis, Totti, Water Sports, Wayne Rooney, Winter Sports, Zidane </h4></td></tr></table>";
alien_content         = "<table border='0' width='250' class='newstable' cellpadding='1' cellspacing='1' id= 'alientable'><tr><td  align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper alien</span></td></tr><tr><td  colspan='2' class='newsheader'><h4>aliens creatures from H.R. Giger - Alien's movie creator, strange visions and fantasies, have a look...</h4></td></tr></table>";
celebrities_content   = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'celebritiestable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download wallpaper celebrity</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Tom Cruise, Pierce Brosnan, Mel Gibson, Keanu Reevs, Harrison Ford, George Clooney, David Duchovny, Bruce Willis, Brad Pitt, Ben Affleck, Antonio Banderas, Catherine Zeta Jones, Tea Leoni, Sharon Stone, Sandra Bullock, Salma Hayek, Penelope Cruz, Michelle Peiffer, Marylin Monroe, Mariah Carey, Laetitia Casta, Kylie Minogue, Kate Moss, Jennifer Lopez, Jennifer Aniston, Gillian Anderson, Georgina Robertson, Claudia Schiffer, Charlize Theron, Cameron Diaz, Angelina Jolie, Alicia Silverstone</h4></td></tr></table>";
bodypainting_content  = "<table border='0' width='250' class='newstable' cellpadding='1' cellspacing='1' id= 'bodypaintingtable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download bodypainting body art tatoo</span></td></tr><tr><td colspan='2' class='newsheader'><h4>some fun pictures about this very new (and sometimes quite cool) form of art...</h4></td></tr></table>";
christmas_content     = "<table border='0' width='250' class='newstable' cellpadding='1' cellspacing='1' id= 'christmastable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download christmas wallpaper</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Xmas, Christmas, Santa Claus, New Year, Rudolph, Happy New year wallpapers</h4></td></tr></table>";
manga_content         = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'mangatable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download manga wallpaper</span></td></tr><tr><td colspan='2' class='newsheader'><h4>serialexperiments lain, sakura wars, sailor moon, saber marionette,  ronin warriors, record of lodoss war, neon genesis, gundam, gost in the shell,  el hazard, dragon ballz, dn angel, dirty pair flash, clover, city hunter, card captor sakura, angel sanctuary</h4></td></tr></table>";
advertising_content   = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'advertisingtable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download advertising design wallpapers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>advertising design, sprite, reebock, perfume, nokia, nike, mobile phones, drink, alcatel, adidas</h4></td></tr></table>";
xp_content            = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'xptable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download windows xp wallpapers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Windows XP Operating System wallpapers - refresh your desktop with this new look</h4></td></tr></table>";
dinosaurs_content     = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'dinosaurstable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download dinosaurs wallpapers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Dinosaurs wallpapers - Jurrasica greatest reptiles on your desktop, see how Earth looks million years ago </h4></td></tr></table>";
travel_content        = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'traveltable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download travel wallpapers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Travel wallpapers - see great places to spend your vacation. Some useful info and links are provided also.</h4></td></tr></table>";
linux_content         = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'linuxtable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download linux wallpapers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Linux wallpapers - some wallpapers for Linux users, nice funny, and of course from Linux fans - screw Windose !</h4></td></tr></table>";
nature_content        = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'naturetable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download nature wallpapers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Nature wallpapers - all seasons wallpapers, summer, spring, winter,autumn, lakes, sky, volcanoes, mountains, lightning, more...</h4></td></tr></table>";
tv_content            = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'tvtable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download TV serials wallpapers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>TV wallpapers - Lost, Desperate housewives, Andromeda, Babylon5, Buffy, Monster Inc, Looney Tunes, Pokemon, Pocahontas, Shrek, Roswell, more...</h4></td></tr></table>";
valentine_content     = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'valentinetable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download St. Valentine's Day wallpapers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Valentine's Day wallpapers, lover's day, hearts, be my Valentine</h4></td></tr></table>";
mobiles_content       = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'mobilestable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download mobiles wallpapers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Download  wallpapers suited for your mobile </h4></td></tr></table>";
horror_content        = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'horrortable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download horror wallpapers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Download horror wallpapers, Ring, Stigmata, Event horizon, Jason, Scream, Dracula, vampires</h4></td></tr></table>";
easter_content        = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'eastertable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>download easter wallpapers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>Download easter wallpapers, easter bunny, happy easter day !</h4></td></tr></table>";
firefox_content       = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'firefoxtable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>mozilla firefox wallpapers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>download some brand new mozilla firefox wallpapers</h4></td></tr></table>";
world_cup_germany_2006_content  = "<table border='0' width='300' class='newstable' cellpadding='1' cellspacing='1' id= 'worldcuptable'><tr><td align='center'><img name='exclam' src='../images/exclam.gif' alt=''></td><td width='100%'><span class='smallblackcaption'>world_cup_germany_2006 wallpapers</span></td></tr><tr><td colspan='2' class='newsheader'><h4>download some brand new world_cup_germany_2006 wallpapers</h4></td></tr></table>";




function maxWindow()
{
window.moveTo(0,0);


if (document.all)
{
  top.window.resizeTo(screen.availWidth,screen.availHeight);
}

else if (document.layers||document.getElementById)
{
  if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth)
  {
    top.window.outerHeight = screen.availHeight;
    top.window.outerWidth = screen.availWidth;
  }
}
}



function isValidURL(url){ 
    var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/; 
    if(RegExp.test(url)){ 
		if ( (url.substring(0,4)).toLowerCase() == 'http' ){
			 return true; 
		}
		else{
			 return false;
		}
       
    }else{ 
        return false; 
    } 
} 

function isValidEmail(email){ 
    var RegExp = /^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/ 
    if(RegExp.test(email)){ 
        return true; 
    }else{ 
        return false; 
    } 
} 


function isValidImage(url){
	 lret = false;
     url_array = url.split(".");	 
	 if ( url_array[url_array.length-1] == "jpg" || url_array[url_array.length-1] == "gif" ){
		  lret = true;
	  }
	  return lret;
}



function extractExtension(url){
     extension = '';
     if ( isValidImage(url) ){
	       url_array = url.split(".");
	       extension =  url_array[url_array.length-1];
     }
     else{
	       alert('ERROR Incorect extension !');
     }
 return extension; 
}




function isValid(parm,val) {
  if (parm == "") return true;
  parm = eliminateChar(parm,"\n"); parm = eliminateChar(parm,"\r"); 
  for (i=0; i<parm.length; i++) {
    if (val.indexOf(parm.charAt(i),0) == -1) return false;
  }
  return true;
}
 
function isNum(parm) {return isValid(parm,numb);}
function isSpc(parm) {return isValid(parm,spc);}
function isLower(parm) {return isValid(parm,lwr);}
function isUpper(parm) {return isValid(parm,upr);}
function isAlpha(parm) {return isValid(parm,lwr+upr);}
function isAlphaNum(parm) {return isValid(parm,lwr+upr+numb);} 

function isNumLitere(parm) {return isValid(parm,lwr+upr+numb);} 


//--ltrim,rtrim, trim
function ltrim ( s ){return s.replace( /^\s*/, "" );}

function rtrim ( s ){return s.replace( /\s*$/, "" );}

function trim ( s ){return rtrim(ltrim(s));}






function myFormat(num,decimals)
  {
    var numobj=new NumberFormat();  numobj.setNumber(num);  numobj.setCurrency(false); numobj.setPlaces(decimals);
	return numobj.toFormatted();
  }	


function NumberFormat(num)
{
this.COMMA = ',';
this.PERIOD = '.';
this.DASH = '-'; 
this.LEFT_PAREN = '('; 
this.RIGHT_PAREN = ')'; 
this.LEFT_OUTSIDE = 0; 
this.LEFT_INSIDE = 1;  
this.RIGHT_INSIDE = 2;  
this.RIGHT_OUTSIDE = 3;  
this.LEFT_DASH = 0; 
this.RIGHT_DASH = 1; 
this.PARENTHESIS = 2; 
this.num;
this.numOriginal;
this.hasSeparators = false;  
this.separatorValue;  
this.inputDecimalValue; 
this.decimalValue;  
this.negativeFormat; 
this.negativeRed; 
this.hasCurrency;  
this.currencyPosition;  
this.currencyValue;  
this.places;
this.setNumber = setNumberNF;
this.toUnformatted = toUnformattedNF;
this.setInputDecimal = setInputDecimalNF; 
this.setSeparators = setSeparatorsNF; 
this.setCommas = setCommasNF;
this.setNegativeFormat = setNegativeFormatNF; 
this.setNegativeRed = setNegativeRedNF; 
this.setCurrency = setCurrencyNF;
this.setCurrencyPrefix = setCurrencyPrefixNF;
this.setCurrencyValue = setCurrencyValueNF; 
this.setCurrencyPosition = setCurrencyPositionNF; 
this.setPlaces = setPlacesNF;
this.toFormatted = toFormattedNF;
this.toPercentage = toPercentageNF;
this.getOriginal = getOriginalNF;
this.getRounded = getRoundedNF;
this.preserveZeros = preserveZerosNF;
this.justNumber = justNumberNF;
this.setInputDecimal(this.PERIOD); 
this.setNumber(num); 
this.setCommas(true);
this.setNegativeFormat(this.LEFT_DASH); 
this.setNegativeRed(false); 
this.setCurrency(true);
this.setCurrencyPrefix('$');
this.setPlaces(2);
}
function setInputDecimalNF(val)
{
this.inputDecimalValue = val;
}
function setNumberNF(num)
{
this.numOriginal = num;
this.num = this.justNumber(num);
}
function toUnformattedNF()
{
return (this.num);
}
function getOriginalNF()
{
return (this.numOriginal);
}
function setNegativeFormatNF(format)
{
this.negativeFormat = format;
}
function setNegativeRedNF(isRed)
{
this.negativeRed = isRed;
}
function setSeparatorsNF(isC, separator, decimal)
{
this.hasSeparators = isC;
if (separator == null) separator = this.COMMA;
if (decimal == null) decimal = this.PERIOD;
if (separator == decimal)
{
this.decimalValue = (decimal == this.PERIOD) ? this.COMMA : this.PERIOD;
}
else
{
this.decimalValue = decimal;
}
this.separatorValue = separator;
}
function setCommasNF(isC)
{
this.setSeparators(isC, this.COMMA, this.PERIOD);
}
function setCurrencyNF(isC)
{
this.hasCurrency = isC;
}
function setCurrencyValueNF(val)
{
this.currencyValue = val;
}
function setCurrencyPrefixNF(cp)
{
this.setCurrencyValue(cp);
this.setCurrencyPosition(this.LEFT_OUTSIDE);
}
function setCurrencyPositionNF(cp)
{
this.currencyPosition = cp;
}
function setPlacesNF(p)
{
this.places = p;
}
function toFormattedNF()
{
var pos;
var nNum = this.num; 
var nStr;            
var splitString = new Array(2);   
nNum = this.getRounded(nNum);
nStr = this.preserveZeros(Math.abs(nNum)); 
if (nStr.indexOf(this.PERIOD) == -1)
{
splitString[0] = nStr;
splitString[1] = '';
}
else
{
splitString = nStr.split(this.PERIOD, 2);
}
if (this.hasSeparators)
{
pos = splitString[0].length;
while (pos > 0)
{
pos -= 3;
if (pos <= 0) break;
splitString[0] = splitString[0].substring(0,pos)
+ this.separatorValue
+ splitString[0].substring(pos, splitString[0].length);
}
}
if (splitString[1].length > 0)
{
nStr = splitString[0] + this.decimalValue + splitString[1];
}
else
{
nStr = splitString[0];
}
var c0 = '';
var n0 = '';
var c1 = '';
var n1 = '';
var n2 = '';
var c2 = '';
var n3 = '';
var c3 = '';
var negSignL = (this.negativeFormat == this.PARENTHESIS) ? this.LEFT_PAREN : this.DASH;
var negSignR = (this.negativeFormat == this.PARENTHESIS) ? this.RIGHT_PAREN : this.DASH;
if (this.currencyPosition == this.LEFT_OUTSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n2 = negSignR;
}
if (this.hasCurrency) c0 = this.currencyValue;
}
else if (this.currencyPosition == this.LEFT_INSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n3 = negSignR;
}
if (this.hasCurrency) c1 = this.currencyValue;
}
else if (this.currencyPosition == this.RIGHT_INSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n3 = negSignR;
}
if (this.hasCurrency) c2 = this.currencyValue;
}
else if (this.currencyPosition == this.RIGHT_OUTSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n2 = negSignR;
}
if (this.hasCurrency) c3 = this.currencyValue;
}
nStr = c0 + n0 + c1 + n1 + nStr + n2 + c2 + n3 + c3;
if (this.negativeRed && nNum < 0)
{
nStr = '<font color="red">' + nStr + '</font>';
}
return (nStr);
}
function toPercentageNF()
{
nNum = this.num * 100;
nNum = this.getRounded(nNum);
return nNum + '%';
}
function getRoundedNF(val)
{
var factor;
var i;
factor = 1;
for (i=0; i<this.places; i++)
{	factor *= 10; }
val *= factor;
val = Math.round(val);
val /= factor;
return (val);
}
function preserveZerosNF(val)
{
var i;
val = val + '';
if (this.places <= 0) return val; 
var decimalPos = val.indexOf('.');
if (decimalPos == -1)
{
val += '.';
for (i=0; i<this.places; i++)
{
val += '0';
}
}
else
{
var actualDecimals = (val.length - 1) - decimalPos;
var difference = this.places - actualDecimals;
for (i=0; i<difference; i++)
{
val += '0';
}
}
return val;
}
function justNumberNF(val)
{
val = (val==null) ? 0 : val;
var newVal = val + ""; 
var isPercentage = false;
var isFormattedNeg = false;
if (newVal.indexOf('%') != -1)
{
newVal = newVal.replace(/\%/g, '');
isPercentage = true;
}
if (newVal.indexOf(this.DASH) != -1
|| (newVal.indexOf(this.LEFT_PAREN) != -1 && newVal.indexOf(this.RIGHT_PAREN) != -1))
{
newVal = newVal.replace(/[\-\(\)]/g, '');
isFormattedNeg = true;
}
if (this.inputDecimalValue != this.PERIOD)
{
newVal = newVal.replace(/\./g, '');
}
var itrDecimal;
var tempVal = '';
var foundDecimal = false;
for (itrDecimal=0; itrDecimal<newVal.length; itrDecimal++)
{
if (newVal.charAt(itrDecimal) == this.inputDecimalValue)
{
if (foundDecimal)
{
}
else
{
tempVal = tempVal + this.PERIOD;
foundDecimal = true;
}
}
else
{
tempVal = tempVal + newVal.charAt(itrDecimal);
}
}
newVal = tempVal;
if (isFormattedNeg) newVal = '-' + newVal;
if (isNaN(newVal))
{
newVal = parseFloat(newVal.replace(/[^\d\.\-]/g, ''));
newVal = (isNaN(newVal) ? 0 : newVal); 
}
else if (!isFinite(newVal))
{
newVal = 0;
}
if (isPercentage)
{
newVal = newVal / 100;
}
return newVal;
}


function isNumeric(sText){
   var ValidChars = "0123456789";
   var IsNumber=true;
   var xChar;
   var pointCounters = 0;
   var i;
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      xChar = sText.charAt(i); 
      if (ValidChars.indexOf(xChar) == -1) 
         {
         IsNumber = false;
         }
	  if (xChar == '.') pointCounters++;
      }
   if (pointCounters > 1) IsNumber = false;    
   return IsNumber;   
}



function eliminateChar(mystring,whatChar){
var source=mystring;
var destination="";
var i;
for(i=0;i<source.length;i++){
      destination+=(source.charAt(i)!= whatChar ? source.charAt(i) : "");
   }
return destination;
}


function addSlashes(mystring,whatChar){
var source=mystring;
var destination="";

var i;
for(i=0;i<source.length;i++){
      destination+=( source.charAt(i)!= whatChar ? source.charAt(i) : ("\\")+source.charAt(i) );
   }


return destination;
}




function emailCheck (emailStr)
{
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

	var matchArray=emailStr.match(emailPat);

	if (matchArray==null)	{return false;}

	var user=matchArray[1];
	var domain=matchArray[2];

	if (user.match(userPat)==null)	{return false;}

	var IPArray=domain.match(ipDomainPat);

	if (IPArray!=null)
	{
		for (var i=1;i<=4;i++)
		{
		  if (IPArray[i]>255) {return false;}
		}
		return true;
	}

	var domainArray=domain.match(domainPat);

	if (domainArray==null)	{return false;}

	var atomPat=new RegExp(atom,"g");
	var domArr=domain.match(atomPat);
	var len=domArr.length;

	if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3)
	{return false;}

	if (len<2)	{return false;}

	return true;
}

function getDataEng(){
   var today = new Date();
   return Days[today.getDay()]+' '+today.getDate()+' '+Months[today.getMonth()]+' '+today.getYear();
}


function dynamiccontent(elementid,content){
  /*
   * minunata functie pentru schimbarea dinamica a continutului unei div, td, span sau orice alt dhtml object 
   */
  if(document.all){
     document.getElementById(elementid).innerHTML=content
  }
  else{
             if (document.getElementById && !document.all){
                rng = document.createRange();
                el = document.getElementById(elementid);
                rng.setStartBefore(el);
                htmlFrag = rng.createContextualFragment(content);
                while (el.hasChildNodes()) el.removeChild(el.lastChild);
                el.appendChild(htmlFrag);
            }
  }
}


function zwindow(source,name,width,height,nHow)
{
  /*
  nHow == 0 - centered;
  nHow == 1 - up left
  */
  var screenWidth,screenHeight,splashWin; 
  screenWidth  = screen.availWidth;
  screenHeight = screen.availHeight;  
  if(nHow == 0)
  {
    if(ie||dom) { splashWin = window.open(source,name, "width="+width+",height="+height+",left="+(screenWidth-width)/2+",top="+(screenHeight-height)/2+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0" ); }
    if(ns) { splashWin = window.open(source,name, "width="+width+",height="+height+",screenX="+(screenWidth-width)/2+",screenY="+(screenHeight-height)/2+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0" ); }
  }
  if(nHow == 1)
  {
    if(ie||dom) { splashWin = window.open(source,name, "width="+width+",height="+height+",left=7,top=18,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0" ); }
    if(ns) { splashWin = window.open(source,name, "width="+width+",height="+height+",screenX=0,screenY=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0" ); }
  }
  
}



function emailpassword(){
   work = "emailpassword.php";
   window.open(work,'email', config='height=200,width=500, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no')
}








String.prototype.replaceAll = function( 
strTarget, // The substring you want to replace
strSubString // The string you want to replace in.
){
var strText = this;
var intIndexOfMatch = strText.indexOf( strTarget );
 

// Keep looping while an instance of the target string
// still exists in the string.
while (intIndexOfMatch != -1){
// Relace out the current instance.
strText = strText.replace( strTarget, strSubString )
 

// Get the index of any next matching substring.
intIndexOfMatch = strText.indexOf( strTarget );
}
 

// Return the updated string with ALL the target strings
// replaced out with the new substring.
return( strText );
}
















