function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function dpSmartLink(u,n,w,h,p) { // v1.4 by David Powers
  var a,j,k,x,y,f='';if(!n){n='';}if(w){f+='width='+w+',';}if(h){f+='height='+h+',';}
  if(p){p=p.split(':');if(p[0]!='z'){p[0]=='c'?(x=(screen.width-w)/2):x=p[0];f+='left='+x+',';}
  if(p[1]!='z'){if(p[0]=='c'){y=(screen.height-h-p[1])/2;if(navigator.appName.indexOf('Op')!=-1){
  y-=96;y=y<0?0:y;}}else{y=p[1];}f+='top='+y+',';}}a=arguments.length;if(a>5){for (k=5;k<a;k++){
  switch(arguments[k]){case 'all':f+='toolbar,menubar,location,scrollbars,status,resizable,';break;
  case 't':f+='toolbar,';break; case 'm':f+='menubar,';break;case 'l':f+='location,';break;
  case 'sc':f+='scrollbars,';break;case 's':f+='status,';break;case 'r':f+='resizable,';}}}
  if(f.charAt(f.length-1)==','){f=f.slice(0,-1);}j=window.open(u,n,f);j.focus();
  document.MM_returnValue=false;
}

var aIds = Array( 'pg_fa00a95b18' );
function ChangePage( to_hide, to_show )
{
   var tbl_hide = document.getElementById( aIds[to_hide] );
   var tbl_show = document.getElementById( aIds[to_show] );

   if ( typeof(tbl_hide)=='object' && tbl_hide!=null )
    if ( typeof(tbl_show)=='object' && tbl_show!=null )
    {
       tbl_hide.style.display = 'none';
       tbl_show.style.display = '';
    }
}

function NotEmpty( old_res, id, field_title )
{
   if ( old_res==0 )
   {
      var el = document.getElementById( id );
      if ( typeof(el)=='object' && el!=null )
        if ( el.value=='' )
        {
           alert( 'You should fill the suggestion box.' );
           return 1;
        }
   }
   return 0;
}

function CheckPagefa00a95b18()
{
   var nResult = 0;
   nResult += NotEmpty( nResult, 'fld_91f8d8a5f3','Enter your suggestion:' );

   if ( nResult == 0 )
   {
      if (1)
      {
         var el = document.getElementById( 'frm_cc07d90728' );
         if ( typeof(el)=='object' && el != null ) el.submit();
      }
      else ChangePage( 0, 1 );
   }
}

function OnChangeShipSameAsOrd(field, formid) {
	if (field.checked == true) {
		document.getElementById('divShipping').style.display = '';
		formid.sFirstName.value = "";
		formid.sLastName.value = "";
		formid.sStreet.value = "";
		formid.sCity.value = "";
		formid.sPC.value = "";
		formid.sProvince.value = "";
	} else {
		document.getElementById('divShipping').style.display = 'none';
		formid.sFirstName.value = document.getElementById('FirstName').value;
		formid.sLastName.value = document.getElementById('LastName').value;
		formid.sStreet.value = document.getElementById('Street').value;
		formid.sCity.value = document.getElementById('City').value;
		formid.sPC.value = document.getElementById('PC').value;
		formid.sProvince.value = document.getElementById('Province').value;		
	}
}

function OnChangeShipSameAsOrd2(field, formid) {
	if (field.checked == true) {
		document.getElementById('divShShipping').style.display = '';
		formid.shsFirstName.value = "";
		formid.shsLastName.value = "";
		formid.shsStreet.value = "";
		formid.shsCity.value = "";
		formid.shsPC.value = "";
		formid.shsProvince.value = "";
	} else {
		document.getElementById('divShShipping').style.display = 'none';
		formid.shsFirstName.value = document.getElementById('shFirstName').value;
		formid.shsLastName.value = document.getElementById('shLastName').value;
		formid.shsStreet.value = document.getElementById('shStreet').value;
		formid.shsCity.value = document.getElementById('shCity').value;
		formid.shsPC.value = document.getElementById('shPC').value;
		formid.shsProvince.value = document.getElementById('shProvince').value;
	}
}

function OnChangeShipSameAsOrd3(field, formid) {
	if (field.checked == true) {
		formid.sFirstName.value = "";
		formid.sLastName.value = "";
		formid.sStreet.value = "";
		formid.sCity.value = "";
		formid.sPC.value = "";
		formid.sProvince.value = "";
	} else {
		formid.sFirstName.value = document.getElementById('FirstName').value;
		formid.sLastName.value = document.getElementById('LastName').value;
		formid.sStreet.value = document.getElementById('Street').value;
		formid.sCity.value = document.getElementById('City').value;
		formid.sPC.value = document.getElementById('PC').value;
		formid.sProvince.value = document.getElementById('Province').value;		
	}
}

// common utils

// checks input field against default value and cleans the field
function clean_input(field, value)
{
	if (field.value==value)
	{
		field.value="";
	}
	return true;
} // clean_input()

function addBookmark(url, title) {
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

function swapCcVisibility()
{
	var cardType = document.getElementById("CreditCard");
	var switchfieldset = document.getElementById("switchdata");

	if (cardType.selectedIndex == 3 || cardType.selectedIndex == 4) {
		switchfieldset.className="showregion";
	} else {
		switchfieldset.className="hideregion";
	}
}
