
/* Start : search  Suggest*/
Event.observe(window,'load',pageLoad);

function searchSuggest(text, li) {
	var qElm = li.down();
	var qText = qElm.innerHTML.stripTags();

	var qField = $('q');
	qField.value = qText;
	var myForm = $('product-search-form');
	myForm.submit();
}

function suggestCallback(inputField,suggestQuery)
{
	var typeField = $F('q_support');
	
	var qString = '<?php echo PUBLIC_SITE_ROOT; ?>/ajax/search_suggest.php?'+suggestQuery+'&type='+typeField;

	return qString;
}

function pageLoad()
{
	new Ajax.Autocompleter( 'q','search-suggest-dropdown','/ajax/search_suggest.php',{minChars:2,callback:suggestCallback,afterUpdateElement:searchSuggest,onHide:function(element, update){ new Element.hide(update) }} );

	$('opentip1').addTip('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 'Hello world!');
}
/* End : search  Suggest*/



// Frame breaker
if(top.location!=location){
	top.location.href = document.location.href;
}


function printPage()
{
	window.print();
};



function toggle_fullscreen(element_id,bg_element_id)
{
//alert('ezdfsqfq');
	var myDiv = $(element_id);
	var bgDiv = $(bg_element_id);
	
	if(myDiv.hasClassName('fullscreen'))
	{
		myDiv.removeClassName('fullscreen');
		bgDiv.removeClassName('fullscreen-bg');
	}
	else
	{
		myDiv.addClassName('fullscreen');
		bgDiv.addClassName('fullscreen-bg');
	}
}


var Popup = {
  open: function(options)
  {
    this.options = {
      url:'#',
      width:740,
      height:500,
      name:'_blank',
      location:'no',
      menubar:'no',
      toolbar:'no',
      status:'yes',
      scrollbars:'yes',
      resizable:'yes',
      left:'',
      top:'',
      normal:false
    }
    Object.extend(this.options, options || {});

    if (this.options.normal){
        this.options.menubar = "yes";
        this.options.status = "yes";
        this.options.toolbar = "yes";
        this.options.location = "yes";
    }

    this.options.width = this.options.width < screen.availWidth?this.options.width:screen.availWidth;
    this.options.height=this.options.height < screen.availHeight?this.options.height:screen.availHeight;
    var openoptions = 'width='+this.options.width+',height='+this.options.height+',location='+this.options.location+',menubar='+this.options.menubar+',toolbar='+this.options.toolbar+',scrollbars='+this.options.scrollbars+',resizable='+this.options.resizable+',status='+this.options.status
    if (this.options.top!="")openoptions+=",top="+this.options.top;
    if (this.options.left!="")openoptions+=",left="+this.options.left;
    window.open(this.options.url, this.options.name,openoptions );
    return false;
  }
}

