var scr = getcookie('screensz');
if(!scr){ 
 scr = 'normal'; 
 setcookie('screensz',scr);
}
 
function setStyle(what) {
 setcookie('screensz',what);
 window.location = window.location.href;
}
 
function bookmark() {
 var title = "Healthalot Search Engine";
 var url   = "http://www.healthalot.com";

 if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
 } else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); 
 } else {
    alert("To bookmark this site press [Ctrl+D] keys.");
 }
}

function openWin(lnk,vid,bid,mid) {
 window.open("vendor.php?url="+escape(lnk)+
   "&vid="+vid+"&bid="+bid+"&mid="+mid, vid).focus();
}

function clearTxt(elem) {
 if(elem.firstClick != 0) {
    elem.firstClick = 0;
    elem.innerText = "";
 }
}

function NewWindow(mypage, myname, w, h, scroll) {
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
  win = window.open(mypage, myname, winprops)
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function printPage() {
 if (window.print) // NS4, IE5
    window.print()
 else // other browsers
   alert('Use your browser Print\nfunction to print this page.');
}

function trim(s){
  return s.replace(/^\s*/,'').replace(/\s*$/,'');
}

function setcookie(cookiename, value, expdays){
 if(!expdays) expdays = 30;
 date = new Date();
 date.setTime(date.getTime() + (expdays * 24 * 3600 * 1000));
 document.cookie= cookiename+'='+trim(escape(value)) + "; expires=" + date.toGMTString();
}
function getcookie(cookiename) {
 var cookiestring=""+document.cookie;
 var index1=cookiestring.indexOf(cookiename);
 if (index1==-1 || cookiename=="") return ""; 
 var index2=cookiestring.indexOf(';',index1);
 if (index2==-1) index2=cookiestring.length; 
 var cookieVal = cookiestring.substring(index1+cookiename.length+1,index2);
 if(cookieVal == ';') { return ""; }
 else { return unescape(cookieVal); }
}


function srchFrmChk(frm) {
 var search = '';
 for(var i=0; i<frm.elements.length; i++) { 
  if(frm.elements[i].type != 'submit') search += frm.elements[i].value; 
 }
 if(search != '-1-1-1-1-1') {
    return true;
 } else {
    alert("Please select any search creteria first!");
 }
 return false;
}

function orderBy(order){
 location = location.href.replace(/&order=\d/, '')+'&order='+order;
}

function orderPostBy(order){
 frm = document.forms.siteFrm;
 frm.order.value = order;
 frm.submit();
}
