﻿// JScript File



function popUpGallery(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=660,height=700,left = 590,top = 275');");
}


function openReSizableWindowNew(mode,url,name) {
    name = 'w' + Math.round(Math.random()*(1000000000));
    w = screen.width - 10;
    h = screen.height - 40;

    if (mode == 'main') 
        {nurl = url + '?fm=2'}
    else 
        {nurl = url + '&fm=2'}

    window.open(nurl,name,'toolbar=no,menubar=no,resizable=yes,scrollbars=yes,left=0,top=0,width=' + w + ',height=' + h);
}

    
function clearBox(inputbutton, fillValue){
    if (inputbutton.value==fillValue) {
	    inputbutton.value=''
    }
}

function fillBox(inputbutton, fillValue){
    if (inputbutton.value=="") {
	    inputbutton.value=fillValue
    }
}
    
function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=520,height=700,left = 590,top = 275');");
}

function popUpBig(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=0,width=600,height=600,left = 590,top = 275');");
}

function URLEncode (clearString) {   
  var output = '';   
  var x = 0;   
  clearString = clearString.toString();   
  var regex = /(^[a-zA-Z0-9_.]*)/;   
  while (x < clearString.length) {   
    var match = regex.exec(clearString.substr(x));   
    if (match != null && match.length > 1 && match[1] != '') {   
        output += match[1];   
      x += match[1].length;   
    } else {   
      if (clearString[x] == ' ')   
        output += '+';   
      else {   
        var charCode = clearString.charCodeAt(x);   
        var hexVal = charCode.toString(16);   
        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();   
      }   
      x++;   
    }   
  }   
  return output;   
}   

function SubmitOnEnter(myfield, e, searchMode) {   
    var keycode;
    if (window.event)   
        keycode = window.event.keyCode;   
    else if (e)   
        keycode = e.which;   
    else  
        return true;   
        
    if (keycode == 13) {  
        
        if (searchMode == 'home') {
            LeftBarSearch();
        }
        else {
            SearchSite();   
        } 
        
        return false;   
    }   
    else  
        return true;   
}       