/*
Quick.Cms plugins JavaScript
*/

/*
This script will give the function for the link that opens in a new window and validates by W3 as well. Contributed by Boffa.
Ad the link to the script under the head section.
<script defer type="text/javascript" src="newwin.js"></script>
Call the function with class="newwin" 

*/
window.onload = function() {
var links = document.getElementsByTagName('a');
for (var i=0;i < links.length;i++) {
if (links[i].className == 'newwin') {
links[i].onclick = function() {
window.open(this.href);
return false;
};
}
}
};
/*
//////////// end function newwin
*/
////* Remember Me checkbox ***
var aUserDataNames = new Array( 'sLogin', 'sPass' );

function saveUserData( sName, sValue ){
  createCookie( sName, sValue, 2 );
}

function createCookie( sName, sValue, iDays ){
  sValue = escape( sValue );
  if( iDays ){
    var oDate = new Date();
    oDate.setTime( oDate.getTime() + ( iDays*24*60*60*1000 ) );
    var sExpires = "; expires="+oDate.toGMTString();
  }
  else
    var sExpires = "";
  document.cookie = sName+"="+sValue+sExpires+"; path=/";
}

function throwCookie( sName ){
  var sNameEQ = sName + "=";
  var aCookies = document.cookie.split( ';' );
  for( var i=0; i < aCookies.length; i++ ){
    var c = aCookies[i];
    while( c.charAt(0) == ' ' )
      c = c.substring( 1, c.length );
    if( c.indexOf( sNameEQ ) == 0 )
      return c.substring( sNameEQ.length, c.length );
  }
  return null;
}

function delCookie( sName ){
  createCookie( sName, "", -1 );
}

function checkSavedUserData( ){
  var iCount = aUserDataNames.length;
  var sCookie = null;
  var oForm = gEBI( "oLoginForm" );
  for( var i = 0; i < iCount; i++ ){
    sCookie = throwCookie( aUserDataNames[i] );
    if( sCookie && sCookie != '' ){
      if( gEBI( aUserDataNames[i] ) )
        gEBI( aUserDataNames[i] ).value = unescape( sCookie );
      else if( oForm[aUserDataNames[i]] )
        oForm[aUserDataNames[i]].value = unescape( sCookie );
    }
  } // end for
} // end function checkSavedUserData

function delSavedUserData( ){
  var iCount = aUserDataNames.length;
  var sCookie = null;
  for( var i = 0; i < iCount; i++ ){
    delCookie( aUserDataNames[i] );
  } // end for
} // end function delSavedUserData

//*** City Hiden-Show  ***
// Show Address Listing from City 
function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
obj.display=v;
}
}

function show_city(city)
{
MM_showHideLayers(
'kiev_','','hide',
'vin_','','hide',
'vol_','','hide',
'dnp_','','hide',
'doneck_','','hide',
'zhitomir_','','hide',
'zp_','','hide',
'i-f_','','hide',
'kirovograd_','','hide',
'lugansk_','','hide',
'lvov_','','hide',
'nikolaev_','','hide',
'odessa_','','hide',
'poltava_','','hide',
'rovno_','','hide',
'sevastopol_','','hide',
'simpheropol_','','hide',
'sumy_','','hide',
'ternopol_','','hide',
'uzhgorod_','','hide',
'kharkov_','','hide',
'kherson_','','hide',
'khmelnick_','','hide',
'cherkasy_','','hide',
'chernigov_','','hide',
'chernovcy_','','hide'
);
MM_showHideLayers(city,'','show');
} // end Show City