/**
 * @package pearltea
 * @copyright Copyright 2007 7days Team
 * @license http://www.7daysget.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: frmCheck.js - create by tankai 2007-10-19 
 */

function idObj(obj){
	return typeof(obj) == "string" ? document.getElementById(obj) : obj;
}

 
function field_check(name, rule, field){
  	if(rule.indexOf("cpwd")>-1){
		strTmp = rule.split("#");
		if(strTmp[0].inc("cpwd","/") == true && field.value != idObj(strTmp[1]).value){
			return "The "+name+" must match your " +name.split(" Confirmation")[0];
		}
	}	
	if(rule.inc("eml","/")==true && !/(\,|^)([\w+._]+@\w+\.(\w+\.){0,3}\w{2,4})/.test(field.value.replace(/-|\//g,"")) && !isNone(field.value)){
		return "Is your " + name + " correct? Sorry, my system does not understand your email address.";
	}	
	if(rule.inc("tel","/")==true && !/(^[0-9+-]{3,30}$)/.test(field.value) && !isNone(field.value)){
		return "Is your "+name+" correct? Sorry, my system does not understand your telephone format.";
	}	
	size = rule.sub("min","/");
	if(size > 0 ){			
		if(field.value.trim().length < size && field.value.trim().length>0){
			return "Is your "+ name +" correct? Our system requires a minimum of "+size+" characters.";
		}
	}		
	size = rule.sub("max","/");		
	if(size > 0 ){
		if(field.value.trim().length > size){
			return "Is your "+ name +" correct? Our system requires a maximum of "+size+" characters."
		}
	}	
	if(rule.inc("nnull","/") == true && isNone(field.value)){
		return "Sorry, "+name+" information is required.";		
	}	
	if(rule.inc("ischeck","/") == true && ! field.checked ){
		return name;
	}
	if(rule.inc("isselect","/") == true && field.value == '-1' ){
		return 'Please Choose "' + name + '"';
	}	
	return "";
};

/*#±íµ¥ÑéÖ¤#*/
function fmChk(fm){
	var name , rule , tmp , msgStr , size;
	if(fm == null || fm.tagName != "FORM"){
		alert("", null , "error");
	    return;
	}	
	for(i=0;i<fm.length;i++){		
		var msgStr = chkInput(fm[i]);				
		if(msgStr != "success"){
			efocu(fm[i]);
			msg(msgStr);
			return false;
		}
	}
	return true;
};

function chkInput(obj){
	var name , rule , msgStr;
	name=obj.getAttribute("chkName");
	rule=obj.getAttribute("chkRule");
	if(isNone(rule) || isNone(name))  return "success";	
	msgStr = field_check(name, rule, obj);
	
	if(msgStr != ""){
		return msgStr;
	}
	else{
		return "success";
	}
};

function msg(key){
	alert(key);
};

function initForm(el, func){	
	var img_path = baseURL + "includes/templates/lightinthebox/images/checkout";
	(new Image(10,10)).src = img_path + "/ico_F.gif";
	var error_bg = "#FEDFDF", blur_bg = "" , focus_bg = "#FFFEE1";
	var formId = idObj(el);
	if(formId == null || formId.tagName != "FORM"){
		alert("", null , "error");
	    return;
	}
	var addImage = '<img src="'+ img_path + "/ico_T.gif" +'" width="10" height="10" style="display:none;" class="pad_l"/>';
	var addDiv = '<div style="display:none;" class="red line_120"></div>';
	var elArr = formId.elements;
	var elLen = elArr.length;
	for(i=0; i<elLen; i++) {
		//insert the img and div
		var addHtml = elArr[i].getAttribute("chkRule");
		if(addHtml){
			insHtm(elArr[i],addImage);
			insHtm(elArr[i],addDiv);
			
			//add the mouse style have check;
			elArr[i].onfocus = function(){
					if((this.tagName === "INPUT" && (this.type === "text" || this.type === "password"))||this.tagName === "TEXTAREA")
					{this.style.backgroundColor = focus_bg;}
			}
			elArr[i].onblur = function(){
				this.style.backgroundColor = blur_bg;	
				var out_img = this.parentNode.getElementsByTagName("img")[0];
				var out_text = this.parentNode.getElementsByTagName("div")[0];
				var msg = chkInput(this);
				if(msg === "success") {
					out_img.src = img_path + "/ico_T.gif";
					out_img.style.display="inline";
					out_text.style.display="none";
				}else{
					out_img.src = img_path + "/ico_F.gif";						
					out_img.style.display="inline";
					out_text.innerHTML = msg;
					out_text.style.display="block";
					if((this.tagName === "INPUT" && (this.type === "text" || this.type === "password"))||this.tagName === "TEXTAREA"){
						this.style.backgroundColor = error_bg;
					}
				}
				if(func != null) {try{eval(func);}catch(e){}}						
			}
		}else{
				//add the mouse style not check;
			if((elArr[i].tagName === "INPUT" && (elArr[i].type === "text" || elArr[i].type === "password"))||elArr[i].tagName === "TEXTAREA"){
				elArr[i].onfocus = function(){this.style.backgroundColor = focus_bg;}
				elArr[i].onblur = function(){this.style.backgroundColor = blur_bg; if(func != null) {try{eval(func);}catch(e){}}}
			}
		}
	}
}
var isWin = (navigator.platform == "Win32") || (navigator.platform == "Windows");        
var isIE=navigator.userAgent.indexOf("IE")>0;
var isIE5=navigator.userAgent.indexOf("IE 5.0")>0;
var isIE6=navigator.userAgent.indexOf("IE 6.0")>0;
var isNav=(navigator.appName.indexOf("Netscape")!=-1);
var element;

/*swich the layer*/
function layerswich(){	
	if(idObj('boxswitch') === null ) {return;}
	var e, i = 0;
	var evtType = idObj('boxswitch').getAttribute('evt');	
	while (e = idObj('boxswitch').getElementsByTagName ('DIV') [i++]) {
		if (e.className == 'on' || e.className == 'off') {
			if(evtType=='click'){
				e.onclick = function () {
					var getEls = idObj('layer_switch').getElementsByTagName('DIV');
						for (var z=0; z<getEls.length; z++) {
						getEls[z].className=getEls[z].className.replace('show', 'hide');
						getEls[z].className=getEls[z].className.replace('on', 'off');
						}
					this.className = 'on';
					var max = this.getAttribute('title');
					idObj(max).className = "show";
				}
			}
			else{
				e.onmouseover = function () {
					var getEls = idObj('layer_switch').getElementsByTagName('DIV');
						for (var z=0; z<getEls.length; z++) {
						getEls[z].className=getEls[z].className.replace('show', 'hide');
						getEls[z].className=getEls[z].className.replace('on', 'off');
						}
					this.className = 'on';
					var max = this.getAttribute('title');
					idObj(max).className = "show";
				}
			}
		}	
	}

}

function hide(el) {
	element = idObj(el);
	element.style.display = 'none';
}

function show(el) {
	element = idObj(el);
	element.style.display = '';
}
function remove(el){
	element = idObj(el);
	element.parentNode.removeChild(element);
}
function toggle(el) {
    el = idObj(el);
	if(el.style.display=="none"){
		el.style.display='block';
	}else{
		el.style.display='none';
	}
}

/*==================================================*/

function scrollup(o,h,d){	
	timer_flg = false;
	if(d==h){
	   var t = o.firstChild;
	   o.appendChild(t);
	   t.style.marginTop=o.firstChild.style.marginTop='0px';
	   d=0;
	   timer_flg = true;
	}
	else{
	   var s=3,d=d+s,l=(d>=h?d-h:0);
	   o.firstChild.style.marginTop=-d+l+'px';
	   window.setTimeout(function(){scrollup(o,h,d-l)},20);
	}
}

/*swich the layer*/
function clicklayerswich(){	
	if(idObj('boxswitch') == null ) return;
	var e, i = 0;
	while (e = idObj('boxswitch').getElementsByTagName ('DIV') [i++]) {
		if (e.className == 'on' || e.className == 'off') {
		e.onclick = function () {
			var getEls = idObj('layer_switch').getElementsByTagName('DIV');
				for (var z=0; z<getEls.length; z++) {
				getEls[z].className=getEls[z].className.replace('show', 'hide');
				getEls[z].className=getEls[z].className.replace('on', 'off');
				}
			this.className = 'on';
			var max = this.getAttribute('title');
			idObj(max).className = "show";
			}
		}		
	}
}
/* marque => bof*/
function srcMarquee(){
	this.ID = idObj(arguments[0]);
	if(!this.ID){this.ID = -1;return;}
	this.Direction = this.Width = this.Height = this.DelayTime = this.WaitTime = this.Correct = this.CTL = this.StartID = this.Stop = this.MouseOver = 0;
	this.Step = 1;
	this.Timer = 30;
	this.DirectionArray = {"top":0 , "bottom":1 , "left":2 , "right":3};
	if(typeof arguments[1] == "number")this.Direction = arguments[1];
	if(typeof arguments[2] == "number")this.Step = arguments[2];
	if(typeof arguments[3] == "number")this.Width = arguments[3];
	if(typeof arguments[4] == "number")this.Height = arguments[4];
	if(typeof arguments[5] == "number")this.Timer = arguments[5];
	if(typeof arguments[6] == "number")this.DelayTime = arguments[6];
	if(typeof arguments[7] == "number")this.WaitTime = arguments[7];
	if(typeof arguments[8] == "number")this.ScrollStep = arguments[8]
	this.ID.style.overflow = this.ID.style.overflowX = this.ID.style.overflowY = "hidden";
	this.ID.noWrap = false;
	this.IsNotOpera = (navigator.userAgent.toLowerCase().indexOf("opera") == -1);
	if(arguments.length >= 7)this.Start();
}

srcMarquee.prototype.Start = function(){
	if(this.ID == -1)return;
	if(this.WaitTime < 800)this.WaitTime = 800;
	if(this.Timer < 20)this.Timer = 20;
	if(this.Width == 0)this.Width = parseInt(this.ID.style.width);
	if(this.Height == 0)this.Height = parseInt(this.ID.style.height);
	if(typeof this.Direction == "string")this.Direction = this.DirectionArray[this.Direction.toString().toLowerCase()];
	this.HalfWidth = Math.round(this.Width / 2);
	this.BakStep = this.Step;
	this.ID.style.width = this.Width;
	this.ID.style.height = this.Height;
	if(typeof this.ScrollStep != "number")this.ScrollStep = this.Direction > 1 ? this.Width : this.Height;
	var msobj = this;
	var timer = this.Timer;
	var delaytime = this.DelayTime;
	var waittime = this.WaitTime;
	msobj.StartID = function(){msobj.Scroll()}
	msobj.Continue = function(){
		if(msobj.MouseOver == 1){
		setTimeout(msobj.Continue,delaytime);
     }
     else{ clearInterval(msobj.TimerID);
		msobj.CTL = msobj.Stop = 0;
		msobj.TimerID = setInterval(msobj.StartID,timer);
     }
    }
	msobj.Pause = function(){
		msobj.Stop = 1;
		clearInterval(msobj.TimerID);
		setTimeout(msobj.Continue,delaytime);
    }
	msobj.Begin = function(){
   msobj.ClientScroll = msobj.Direction > 1 ? msobj.ID.scrollWidth : msobj.ID.scrollHeight;
   if((msobj.Direction <= 1 && msobj.ClientScroll <msobj.Height) || (msobj.Direction > 1 && msobj.ClientScroll <msobj.Width))return;
   msobj.ID.innerHTML += msobj.ID.innerHTML;
   msobj.TimerID = setInterval(msobj.StartID,timer);
   if(msobj.ScrollStep < 0)return;
   msobj.ID.onmousemove = function(event){
       if(msobj.ScrollStep == 0 && msobj.Direction > 1){
			var event = event || window.event;
			if(window.event){
				if(msobj.IsNotOpera){msobj.EventLeft = event.srcElement.id == msobj.ID.id ? event.offsetX - msobj.ID.scrollLeft : 

event.srcElement.offsetLeft - msobj.ID.scrollLeft + event.offsetX;}
				else{msobj.ScrollStep = null;return;}
			}
			else{msobj.EventLeft = event.layerX - msobj.ID.scrollLeft;}
			msobj.Direction = msobj.EventLeft > msobj.HalfWidth ? 3 : 2;
			msobj.AbsCenter = Math.abs(msobj.HalfWidth - msobj.EventLeft);
			msobj.Step = Math.round(msobj.AbsCenter * (msobj.BakStep*2) / msobj.HalfWidth);
			}
		}
		msobj.ID.onmouseover = function(){
			if(msobj.ScrollStep == 0)return;
			msobj.MouseOver = 1;
			clearInterval(msobj.TimerID);
		}
		msobj.ID.onmouseout = function(){
		if(msobj.ScrollStep == 0){
			if(msobj.Step == 0)msobj.Step = 1;
			return;
		}
		msobj.MouseOver = 0;
		if(msobj.Stop == 0){
			clearInterval(msobj.TimerID);
			msobj.TimerID = setInterval(msobj.StartID,timer);
		}}}
		setTimeout(msobj.Begin,waittime);
}

srcMarquee.prototype.Scroll = function(){
	switch(this.Direction){
	case 0:
	this.CTL += this.Step;
	if(this.CTL >= this.ScrollStep && this.DelayTime > 0){
		this.ID.scrollTop += this.ScrollStep + this.Step - this.CTL;
		this.Pause();
		return;
	}
	else{
		if(this.ID.scrollTop >= this.ClientScroll){this.ID.scrollTop -= this.ClientScroll;}
		this.ID.scrollTop += this.Step;
	}
	break;

	case 1:
	this.CTL += this.Step;
	if(this.CTL >= this.ScrollStep && this.DelayTime > 0){
		this.ID.scrollTop -= this.ScrollStep + this.Step - this.CTL;
		this.Pause();
		return;
	}
	else{
		if(this.ID.scrollTop <= 0){this.ID.scrollTop += this.ClientScroll;}
		this.ID.scrollTop -= this.Step;
	}
	break;

	case 2:
	this.CTL += this.Step;
	if(this.CTL >= this.ScrollStep && this.DelayTime > 0){
		this.ID.scrollLeft += this.ScrollStep + this.Step - this.CTL;
		this.Pause();
		return;
	}
	else{
		if(this.ID.scrollLeft >= this.ClientScroll){this.ID.scrollLeft -= this.ClientScroll;}
		this.ID.scrollLeft += this.Step;
	}
	break;

	case 3:
	this.CTL += this.Step;
	if(this.CTL >= this.ScrollStep && this.DelayTime > 0){
		this.ID.scrollLeft -= this.ScrollStep + this.Step - this.CTL;
		this.Pause();
		return;
	}
	else{
		if(this.ID.scrollLeft <= 0){this.ID.scrollLeft += this.ClientScroll;}
	this.ID.scrollLeft -= this.Step;
	}
	break;
	}
} 

function scrollup_online(o,h,d){
	online_timer_flg = false;
	if(d==h){
	   var t = o.firstChild;
	   o.appendChild(t);
	   t.style.marginTop=o.firstChild.style.marginTop='0px';
	   d=0;
	   online_timer_flg = true;
	}
	else{
	   var s=3,d=d+s,l=(d>=h?d-h:0);
	   o.firstChild.style.marginTop=-d+l+'px';
	   window.setTimeout(function(){scrollup_online(o,h,d-l)},20);
	}
}

/* marque => eof*/
var timer;
function marquee(delay, liHeight, toAlign, lyorderID){	
	var o=idObj(lyorderID);
	var timer_bug;
	for(i=0;i<o.childNodes.length;i++){
		if(o.childNodes[i].tagName == null){
			o.removeChild(o.childNodes[i]);			
		}
	}
	if(o==null) return;
	
	function scrollup(o,h,d){	
		if(d==h){
		   var t = o.firstChild;
		   o.appendChild(t);
		   t.style.marginTop=o.firstChild.style.marginTop='0px';
		   d = 0;
		}
		else{
		   var s=3,d=d+s,l=(d>=h?d-h:0);
		   o.firstChild.style.marginTop=-d+l+'px';
		   timer_bug = setTimeout(function(){scrollup(o,h,d-l)},20);
		}
	}
	timer = setInterval(function(){clearTimeout(timer_bug);scrollup(o,liHeight,toAlign);},delay);
}


///////////////
function addListener(element, type, expression, bubbling)
{
  bubbling = bubbling || false;
  if(window.addEventListener)	{ // Standard
    element.addEventListener(type, expression, bubbling);
    return true;
  } else if(window.attachEvent) { // IE
    element.attachEvent('on' + type, expression);
    return true;
  } else return false;
}

/////////////////
/*the li scroll*/
function page_go(id,num, c,t,cid){
	var Prev = id + "Prev";
	var Next = id + "Next";	
	var pageId = id + "Page";
	var Page = 0;
	var currentPage = 1;
	var PageNumber = Math.ceil(t/num);
	var activeClick = true;
	var gopage = 0;

	if(num>t){activeClick = false;}
	if(c >= num){
		if(t!=null){
			gopage = Math.ceil(c/num);
			if(c % num == 0) gopage++; 		
		}
		updateProduct('goto', gopage);
	}
	
	function updateProduct(type, gopage) {
		if(type=='pre') {Page -= parseInt(num);currentPage--};
		if(type=='next') {Page += parseInt(num);currentPage++};
		if(type=='goto' && gopage != null) {Page = (gopage-1) * num ; currentPage = gopage;}
		if(Page<0) {
			Page=num*(PageNumber-1);
			currentPage=PageNumber;
		}
		if(Page>=t) {
			Page=0;
			currentPage=1;
		}
		
		idObj(pageId).innerHTML = currentPage +'/'+PageNumber;
		
		for(i=0;i<num;i++){
			if(i >= productPrice.length){
				break;
			}
			n_page = i + Page;
			idObj('cell_price'+i).innerHTML=productPrice[n_page];
			idObj('cell_link'+i).href = rewrite_url(productName[n_page], productID[n_page]);
			idObj('cell_link'+i).title = productName[n_page];
			
			idObj('li'+i).style.display='block';
			if(productID[n_page] == null){
				idObj('li'+i).style.display='none';
				continue;
			}
			if(num==4)idObj('cell_img'+i).src=baseURL+"images/root/loading_img_b.gif";
			if(num==8)idObj('cell_img'+i).src=baseURL+"images/root/loading_img_s.gif";
			idObj('cell_img'+i).alt=productName[n_page];
			idObj('cell_img'+i).title=productName[n_page];
			loadImage('cell_img'+i,imgURL+productIMG[n_page]);
			if(cid != null){
				if(cid == productID[n_page]){
					idObj('cell_img'+i).className = 'allborder';
				}
				else{
					idObj('cell_img'+i).className = '';
				}
			}
			
			if(productSourcePrice != null){
				idObj('cell_source_price'+i).innerHTML=productSourcePrice[n_page];
			}
			if(productSubName != null && productName != null){
				idObj('cell_name_link'+i).innerHTML=productSubName[n_page];
				idObj('cell_name_link'+i).href=rewrite_url(productName[n_page], productID[n_page]);
				idObj('cell_name_link'+i).title=productName[n_page];
			}
			if(productFlg != null){
				var tmp = productFlg[n_page].split('#');
				if(tmp.length < 4) continue;
				idObj('sold_out_s'+i).style.display = (tmp[0] > 0) ? 'block' : 'none';
				idObj('almost_sold_out_s'+i).style.display = (tmp[1] > 0) ? 'block' : 'none';				
				if(tmp[2] > 0){
					idObj('product_count_s'+i).innerHTML=tmp[2];
				}
				idObj('product_count_s'+i).style.display = (tmp[2] > 0) ? 'block' : 'none';				
				idObj('sale_item_s'+i).style.display = (tmp[3] > 0) ? 'block' : 'none';				
			}
		}
	}

	idObj(pageId).innerHTML = currentPage +'/'+PageNumber;
	idObj(Prev).onclick = function () {
		if(!activeClick) return false;
		updateProduct('pre');
	}
	idObj(Next).onclick = function () {
		if(!activeClick) return false;
		updateProduct('next');
	}	
}

function postAjax(url,content,onComplete){
	var options=new Object();
	options.method="post";
	options.asynchronous=true;
	options.parameters=content;
	options.onComplete=onComplete;
	return new Ajax.Request(url, options);
}

function checkWholesalNewsletter(id){
	if (idObj(id) == null) return;	
	if(checkEmail(id)){
		hide('wholesale_newsletter_text');
		show('wholesale_newsletter_loading');
			postAjax(window.location.pathname + '?main_page=wholesale_newsletter' , id + '=' + idObj(id).value, function(ajax){
			if(ajax.readyState==4&&ajax.status == 200){		
				idObj('wholesale_newsletter_text').innerHTML = ajax.responseText;
				hide('wholesale_newsletter_loading');
				show('wholesale_newsletter_text');
				if(ajax.responseText.indexOf('touch')>0){
					idObj(id).value = '';
				}
			}
		});	
	}
}

function checkEmail(id){
	var email = idObj(id) == null ? '' : idObj(id).value;
	if(!/(\,|^)([\w+._]+@\w+\.(\w+\.){0,3}\w{2,4})/.test(email.replace(/-|\//g,""))){
		idObj(id).focus();
		alert('Please check your email address.\nYour email addresses should look like "myname@gmail.com"');
		return false;
	}
	else{
		return true;	
	}
}

function back(num){
	history.go(num);
	return false;
}

function floatBox(posEL,element){
	var posX,posY,pos,offTop;
	var width = 339;
	var height = 328; 
	if(isIE){
		pos = idObj(posEL).childNodes[0];
		offTop = 120;
	}else{
		pos = idObj(posEL);
		offTop = 130;
	}
	posX = pos.offsetLeft-width;
	posY = pos.offsetTop-offTop;
	
	var box = idObj('pop_window');
    box.style.position = 'absolute';   
    box.style.zIndex = 999;
    box.style.top = posY + 'px';    
    box.style.left = posX + 'px';    
    box.style.width = width + 'px';    
    box.style.height = height + 'px';
	var str ="<img onclick='close_box(this)' src='"+baseURL+"images/root/close.gif' class='hand' title='close' alt='close' id='floatBox_img'/><div class='png'>";
	switch (element){
		case 'shipping_info':
		                     str += shipping_info;
		                     break;
        case 'payment_option':
                              str += payment_option;
                              break;
		case 'questions':
                              str += questions;
                              break;                              
		default : str += content;
		          break;
		
	}	
	str += "</div>";
	box.innerHTML = str;
	show('pop_window');
	return false;
}
function close_box(obj){
	hide(obj.parentNode.id);
}



function g(o){return document.getElementById(o);}
function HoverLi(n)
{
	for(var i=1;i<=2;i++){g('tb_'+i).className='normaltab';g('tbc_0'+i).className='undis';}
	g('tbc_0'+n).className='dis';g('tb_'+n).className='hovertab';
}

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function ap_showHideLayers() { //v9.0
  var i,p,v,obj,args=ap_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function aps_showHideLayers() { //v9.0
  var i,p,v,obj,args=aps_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function aps_showHideLayers() { //v9.0
  var i,p,v,obj,args=aps_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function img_showHideLayers() { //v9.0
  var i,p,v,obj,args=img_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function menuToggle(element, eventName, handler){
  element = idObj(element);
  if (element.addEventListener) {
	element.addEventListener(eventName, handler, false);
  } else {
	element.attachEvent("on" + eventName, handler);
  }
}
//-

if(typeof(jsonarg)=='object'){
var linkURL = baseURL + 'index.php?main_page=product_info&products_id='
$("#recent_flash_small").jqList(jsonarg);
}


function flashWrite( id, flashUri, vWidth, vHeight, winMode ) {
	var _obj_ = "";
	_obj_ = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + vWidth + '" height="' + vHeight + '" id="' + id + '" align="middle">';
	_obj_ += '<param name="movie" value="' + flashUri + '" />';
	_obj_ += '<param name="quality" value="high" />';
	_obj_ += '<param name="wmode" value="' + winMode + '" />';
	_obj_ += '<param name="bgcolor" value="#ffffff" />';
	_obj_ += '<embed src="' + flashUri + '" quality="high" wmode="' + winMode + '" bgcolor="#ffffff" width="' + vWidth +'" height="' + vHeight + '" id="' + id + '" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>    ';
	_obj_ += '</object>';
	document.write( _obj_ );
}

