/*
  $Id: general.js,v 1.3 2003/02/10 22:30:55 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/


/* Email Validation */

	function validEmail(email) 
	{
		var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
		var checkend=/\.[a-zA-Z]{2,3}$/;

		if((email.search(exclude) != -1) || (email.search(checkend) == -1))	
			return false;

		atPos = email.indexOf("@",0);
		pPos1 = email.indexOf(".",0);
		periodPos = email.indexOf(".",atPos);
		pos1 = pPos1;
		pos2 = 0;
		while (pos2 > -1) 
		{
			pos2 = email.indexOf(".",pos1+1);
			if (pos2 == pos1+1)  
				return false;
			else  
				pos1 = pos2;
		}
		if (atPos == -1)
			return false;
		if (atPos == 0)	
			return false;
		if (pPos1 == 0)	
			return false;
		if(email.indexOf("@",atPos+1) > -1)	
			return false;
		if (periodPos == -1)	
			return false;
		if (atPos+1 == periodPos)	
			return false;
		if (periodPos+3 > email.length)	
			return false;
		return true;
	}

function SetFocus(TargetFormName) {
  var target = 0;
  if (TargetFormName != "") {
    for (i=0; i<document.forms.length; i++) {
      if (document.forms[i].name == TargetFormName) {
        target = i;
        break;
      }
    }
  }

  var TargetForm = document.forms[target];
    
  for (i=0; i<TargetForm.length; i++) {
    if ( (TargetForm.elements[i].type != "image") && (TargetForm.elements[i].type != "hidden") && (TargetForm.elements[i].type != "reset") && (TargetForm.elements[i].type != "submit") ) {
      TargetForm.elements[i].focus();

      if ( (TargetForm.elements[i].type == "text") || (TargetForm.elements[i].type == "password") ) {
        TargetForm.elements[i].select();
      }

      break;
    }
  }
}

function RemoveFormatString(TargetElement, FormatString) {
  if (TargetElement.value == FormatString) {
    TargetElement.value = "";
  }

  TargetElement.select();
}

function CheckDateRange(from, to) {
  if (Date.parse(from.value) <= Date.parse(to.value)) {
    return true;
  } else {
    return false;
  }
}

function IsValidDate(DateToCheck, FormatString) {
  var strDateToCheck;
  var strDateToCheckArray;
  var strFormatArray;
  var strFormatString;
  var strDay;
  var strMonth;
  var strYear;
  var intday;
  var intMonth;
  var intYear;
  var intDateSeparatorIdx = -1;
  var intFormatSeparatorIdx = -1;
  var strSeparatorArray = new Array("-"," ","/",".");
  var strMonthArray = new Array("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
  var intDaysArray = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

  strDateToCheck = DateToCheck.toLowerCase();
  strFormatString = FormatString.toLowerCase();
  
  if (strDateToCheck.length != strFormatString.length) {
    return false;
  }

  for (i=0; i<strSeparatorArray.length; i++) {
    if (strFormatString.indexOf(strSeparatorArray[i]) != -1) {
      intFormatSeparatorIdx = i;
      break;
    }
  }

  for (i=0; i<strSeparatorArray.length; i++) {
    if (strDateToCheck.indexOf(strSeparatorArray[i]) != -1) {
      intDateSeparatorIdx = i;
      break;
    }
  }

  if (intDateSeparatorIdx != intFormatSeparatorIdx) {
    return false;
  }

  if (intDateSeparatorIdx != -1) {
    strFormatArray = strFormatString.split(strSeparatorArray[intFormatSeparatorIdx]);
    if (strFormatArray.length != 3) {
      return false;
    }

    strDateToCheckArray = strDateToCheck.split(strSeparatorArray[intDateSeparatorIdx]);
    if (strDateToCheckArray.length != 3) {
      return false;
    }

    for (i=0; i<strFormatArray.length; i++) {
      if (strFormatArray[i] == 'mm' || strFormatArray[i] == 'mmm') {
        strMonth = strDateToCheckArray[i];
      }

      if (strFormatArray[i] == 'dd') {
        strDay = strDateToCheckArray[i];
      }

      if (strFormatArray[i] == 'yyyy') {
        strYear = strDateToCheckArray[i];
      }
    }
  } else {
    if (FormatString.length > 7) {
      if (strFormatString.indexOf('mmm') == -1) {
        strMonth = strDateToCheck.substring(strFormatString.indexOf('mm'), 2);
      } else {
        strMonth = strDateToCheck.substring(strFormatString.indexOf('mmm'), 3);
      }

      strDay = strDateToCheck.substring(strFormatString.indexOf('dd'), 2);
      strYear = strDateToCheck.substring(strFormatString.indexOf('yyyy'), 2);
    } else {
      return false;
    }
  }

  if (strYear.length != 4) {
    return false;
  }

  intday = parseInt(strDay, 10);
  if (isNaN(intday)) {
    return false;
  }
  if (intday < 1) {
    return false;
  }

  intMonth = parseInt(strMonth, 10);
  if (isNaN(intMonth)) {
    for (i=0; i<strMonthArray.length; i++) {
      if (strMonth == strMonthArray[i]) {
        intMonth = i+1;
        break;
      }
    }
    if (isNaN(intMonth)) {
      return false;
    }
  }
  if (intMonth > 12 || intMonth < 1) {
    return false;
  }

  intYear = parseInt(strYear, 10);
  if (isNaN(intYear)) {
    return false;
  }
  if (IsLeapYear(intYear) == true) {
    intDaysArray[1] = 29;
  }

  if (intday > intDaysArray[intMonth - 1]) {
    return false;
  }
  
  return true;
}

function IsLeapYear(intYear) {
  if (intYear % 100 == 0) {
    if (intYear % 400 == 0) {
      return true;
    }
  } else {
    if ((intYear % 4) == 0) {
      return true;
    }
  }

  return false;
}

/* ------ Added By smartData [15 Sep 2009] -------- */

function LTrim( value ) 
	{
		var re = /\s*((\S+\s*)*)/;
		return value.replace(re, "$1");
	}

	// Removes ending whitespaces
	function RTrim( value ) 
	{
		var re = /((\s*\S+)*)\s*/;
		return value.replace(re, "$1");
	}

	// Removes leading and ending whitespaces
	function trim( value ) 
	{
		return LTrim(RTrim(value));
	}

Array.prototype.in_array = function(p_val) 
{
	for(var i = 0, l = this.length; i < l; i++) 
  {
		if(this[i] == p_val) 
    {
			return true;
		}
	}
	return false;
}

function chkAvail(userName)
{
  if (trim(userName)!="")
  {
    $.ajax({
       type: "POST",
       url: "user_availability.php",
       data: "name=" + userName,
       success: function(msg){
         $("#userConfirm").attr("innerHTML",msg);    
       }
     });
  }
  else
  {
    alert("Enter username!");
    $("#username").focus();
  }
}
//added by smart data on 23/09/2009 start here
function chkAvailadmin(userName)
{
  if (trim(userName)!="")
  {
    $.ajax({
       type: "POST",
       url: "../user_availability.php",
       data: "name=" + userName,
       success: function(msg){
         $("#userConfirm").attr("innerHTML",msg);    
       }
     });
  }
  else
  {
    alert("Enter username!");
    $("#username").focus();
  }
}

function sType(val)
{
  var optArray=new Array('Search Artists','Search Characters','Search Titles','Search All');
  document.getElementById('mOption').innerHTML=optArray[val-1];
  document.getElementById('searchtype').value=val;
} 
//added by smart data on 23/09/2009 end here
//added by smart data on oct 10 2009 start here
function frmsubmit(colValue){
var data_value = document.getElementById('data_' + colValue).innerHTML;
document.getElementById('keysearch').value = data_value;
document.frm_data.submit();
}

function frmsubmitwriter(colValue){
var data_value = document.getElementById('data_' + colValue).innerHTML;
document.getElementById('keysearch_writer').value = data_value;
document.frm_data.submit();
}

function frmsubmitcharacter(colValue){
var data_value = document.getElementById('data_' + colValue).innerHTML;
document.getElementById('keysearch').value = data_value;
document.frm_data.submit();
}
function frmsubmitpagenum(val){
document.getElementById('no_of_res').value = val;
document.frm_data.submit();
}

function frmsubmittitle(val,fname)
{
  var searchVals=new Array('issue','month','art','year','seller','penciller','inker','character','keyword','signature','writer','letter','issuecharacter','genre');
  
  if (searchVals.in_array(fname))
  {
    document.getElementById('keyword').value = val;
    document.getElementById('search_type').value = fname;  
  }
  else
  {
    var data_value = document.getElementById(val).innerHTML;
    document.getElementById('keyword').value = escape(data_value);
    document.getElementById('search_type').value = fname;
  }
  document.frm_title.submit();
} 

//added by smart data on oct 12 2009 end here
//added by smartdata on oct 12 start here
 
// You may use this so long as the copyright notice, above, 
//   and the "more information" statement with URL, below, 
//   are retained.
// Additional instructions and more information can be 
//   obtained from the "Instant Info" article linked from
//   http://willmaster.com/possibilities/archives/
//
//
//
// I N S T R U C T I O N S
//
// These instructions are succinct. See the URL printed above 
//   for more detailed instructions.
//
// First, the following line must be left as is. Don't change it.

LL_infoID = new Array();


// Now that you've left the above line as is, the following 
//   section needs to be customized:
//
// Between the quotation marks, on the lines below, type the ID's 
//   of the layered information text you've created. The number 
//   between the square brackets is the number you've assigned to 
//   the information items. Add/Delete lines as needed, adjusting 
//   the numbers between square brackets to be sequential, starting 
//   with the digit 1

LL_infoID[1] = "mouse_definition";
LL_infoID[2] = "house_definition";
LL_infoID[3] = "email_format_prompt";


//
// End of customization sections.
///////////////////////////////////////////////////////////////


LL_infoID[0] = "unused";
bNS4 = bNS6 = bIE = bOPERA = false;
if     (navigator.userAgent.indexOf("Opera") != -1) { bOPERA = true; }
else if(navigator.userAgent.indexOf("Gecko") != -1) { bNS6 = true;   }
else if(document.layers)                            { bNS4 = true;   }
else if(document.all)                               { bIE = true;    }

LLx = LLxx = LLy = LLyy = 0;
var LL_mousex;
var LL_mousey;
var STO = null;
var SET = false;
var cID = '';
if(bNS4 || bNS6 || bOPERA) { document.captureEvents(Event.MOUSEMOVE); }
document.onmousemove = LL_getmouseposition;


// Functions used by all browsers

function Null() { return; }

function LL_getmouseposition(e)
{
if(bIE || bOPERA) { 
	LL_mousex = event.clientX;
	LL_mousey = event.clientY;
	}
else if(bNS6 || bNS4) {
	LL_mousex = e.pageX;
	LL_mousey = e.pageY;
	}
} // LL_getmouseposition()




// Functions to relay browser type to custom functions

function LL_showinfo(m_section) {
LL_hideallinfo();
if(cID != m_section) { SET = false; }
cID = m_section;
     if(bIE)    { LL_bIE_showit(m_section); }
else if(bNS6)   { LL_bNS6_showit(m_section); }
else if(bOPERA) { LL_bOPERA_showit(m_section); }
else if(bNS4)   { LL_bNS4_showit(m_section); }
} // LL_showinfo()

function LL_hideallinfo(m_section) {
clearTimeout(STO);
     if(bIE)    { LL_bIE_hideallinfo(); }
else if(bNS6)   { LL_bNS6_hideallinfo(); }
else if(bOPERA) { LL_bOPERA_hideallinfo(); }
else if(bNS4)   { LL_bNS4_hideallinfo(); }
} // LL_hideallinfo()




// IE functions

function LL_bIE_hidesection(m_section) {
if(LL_mouseinrectangle()) { return; }
eval(LL_infoID[m_section] + '.style.visibility="hidden"');
} // LL_bIE_hidesection()

function LL_bIE_hideallinfo() {
for(i = 1; i < LL_infoID.length; i++) { 
	eval(LL_infoID[i] + '.style.visibility="hidden"');
	}
} // LL_bIE_hideallinfo()

function LL_bIE_showit(m_section) {
	LL_bIE_hideallinfo();
	var x = LL_mousex + 1;
	if(x < 0) { x = 0; }
	var y = LL_mousey + 20;
	if(y < 0) { y = 0; }
	if(SET == false) {
		eval(LL_infoID[m_section] + '.style.left="' + x + '"');
		eval(LL_infoID[m_section] + '.style.top="' + y + '"');
		}
	eval(LL_infoID[m_section] + '.style.visibility="visible"');
	LLx = eval(LL_infoID[m_section] + '.style.pixelLeft');
	LLxx = eval(LL_infoID[m_section] + '.scrollWidth') + LLx;
	LLy = eval(LL_infoID[m_section] + '.style.pixelTop');
	LLyy = eval(LL_infoID[m_section] + '.scrollHeight') + LLy;
	SET = true;
	clearTimeout(STO);
	STO = setTimeout('SET = false',2000);
} // LL_bIE_showit()



// Netscape 6 functions

function LL_bNS6_hidesection(m_section) {
if(LL_mouseinrectangle()) { return; }
document.getElementById(LL_infoID[m_section]).style.visibility="hidden";
} // LL_bNS6_hidesection()

function LL_bNS6_hideallinfo() {
for(i = 1; i < LL_infoID.length; i++) { 
	document.getElementById(LL_infoID[i]).style.visibility="hidden";
	}
} // LL_bNS6_hideallinfo()

function LL_bNS6_showit(m_section) {
	LL_bNS6_hideallinfo();
	var x = LL_mousex + 1;
	if(x < 0) { x = 0; }
	var y = LL_mousey + 20;
	if(y < 0) { y = 0; }
	if(SET == false) {
		document.getElementById(LL_infoID[m_section]).style.left = x + 'px';
		document.getElementById(LL_infoID[m_section]).style.top = y + 'px';
		}
	document.getElementById(LL_infoID[m_section]).style.visibility="visible";
	var padding = 0;
	if(parseInt(document.getElementById(LL_infoID[m_section]).style.padding) > 0) { padding = parseInt(document.getElementById(LL_infoID[m_section]).style.padding) * 2; }
	LLx = parseInt(document.getElementById(LL_infoID[m_section]).style.left);
	LLxx = parseInt(document.getElementById(LL_infoID[m_section]).style.width) + LLx + padding;
	LLy = parseInt(document.getElementById(LL_infoID[m_section]).style.top);
	LLyy = parseInt(document.getElementById(LL_infoID[m_section]).style.height) + LLy + padding;
	SET = true;
	clearTimeout(STO);
	STO = setTimeout('SET = false',2000);
} // LL_bNS6_showit()



// Opera 6 functions
function LL_bOPERA_hidesection(m_section) {
if(LL_mouseinrectangle()) { return; }
document.getElementById(LL_infoID[m_section]).style.visibility="hidden";
} // LL_bOPERA_hidesection()

function LL_bOPERA_hideallinfo() {
for(i = 1; i < LL_infoID.length; i++) { 
	document.getElementById(LL_infoID[i]).style.visibility="hidden";
	}
} // LL_bOPERA_hideallinfo()

function LL_bOPERA_showit(m_section) {
	LL_bOPERA_hideallinfo();
	var x = LL_mousex + 1;
	if(x < 0) { x = 0; }
	var y = LL_mousey + 20;
	if(y < 0) { y = 0; }
	if(SET == false) {
		document.getElementById(LL_infoID[m_section]).style.left = x + 'px';
		document.getElementById(LL_infoID[m_section]).style.top = y + 'px';
		}
	document.getElementById(LL_infoID[m_section]).style.visibility="visible";
	var padding = 0;
	if(parseInt(document.getElementById(LL_infoID[m_section]).style.padding) > 0) { padding = parseInt(document.getElementById(LL_infoID[m_section]).style.padding) * 2; }
	LLx = parseInt(document.getElementById(LL_infoID[m_section]).style.left);
	LLxx = parseInt(document.getElementById(LL_infoID[m_section]).style.width) + LLx + padding;
	LLy = parseInt(document.getElementById(LL_infoID[m_section]).style.top);
	LLyy = parseInt(document.getElementById(LL_infoID[m_section]).style.height) + LLy + padding;
	SET = true;
	clearTimeout(STO);
	STO = setTimeout('SET = false',2000);
} // LL_bOPERA_showit()



// Netscape 4 functions

function LL_bNS4_hidesection(m_section) {
if(LL_mouseinrectangle()) { return; }
eval('document.' + LL_infoID[m_section] + '.visibility="hide"');
} // LL_bNS4_hidesection()

function LL_bNS4_hideallinfo() {
for(i = 1; i < LL_infoID.length; i++) { 
	eval('document.' + LL_infoID[i] + '.visibility="hide"');
	}
} // LL_bNS4_hideallinfo()

function LL_bNS4_showit(m_section) {
	LL_bNS4_hideallinfo();
	var x = LL_mousex + 1;
	if(x < 0) { x = 0; }
	var y = LL_mousey + 20;
	if(y < 0) { y = 0; }
	if(SET == false) {
		eval('document.' + LL_infoID[m_section] + '.left="' + x + '"');
		eval('document.' + LL_infoID[m_section] + '.top="' + y + '"');
		}
	eval('document.' + LL_infoID[m_section] + '.visibility="show"');
	LLx = eval('parseInt(document.' + LL_infoID[m_section] + '.left)');
	LLxx = eval('parseInt(document.' + LL_infoID[m_section] + '.clip.width)') + LLx;
	LLy = eval('parseInt(document.' + LL_infoID[m_section] + '.top)');
	LLyy = eval('parseInt(document.' + LL_infoID[m_section] + '.clip.height)') + LLy;
	SET = true;
	clearTimeout(STO);
	STO = setTimeout('SET = false',2000);
} // LL_bNS4_showit()


function init(minPrice,maxPrice,minYear,maxYear,defStartYear,defEndYear) {
	
  // - Slider 2 -----------------------------------------
  mySlider2 = new Bs_Slider();
  mySlider2.width         = 120;
  mySlider2.height        = 56;
  mySlider2.imgDir   = 'image/';
  mySlider2.setBackgroundImage('bkg_slider.gif', 'no-repeat');
	
	mySlider2.fieldName     = 'slider2_start';
  mySlider2.minVal        = 0;
  mySlider2.maxVal        = 15000;
  mySlider2.valueInterval = 100;
  mySlider2.valueDefault  = parseInt(minPrice);
  mySlider2.setSliderIcon('slider.gif', 13, 18);
  mySlider2.useInputField = 3;
  mySlider2.styleValueFieldClass = 'sliderInput';
  //mySlider2.colorbar = new Object({ color:'#FFFF00', height:20, widthDifference:-34, offsetLeft:6, offsetTop:37 });
	
	mySlider2.useSecondKnob        = true;
	mySlider2.preventValueCrossing = true;
	mySlider2.wheelAmount        = 0; //disable mouse wheeling cause we have 2 knobs.
	
	mySlider2.fieldName2     = 'slider2_end';
  mySlider2.minVal2        = 0;
  mySlider2.maxVal2        = 15000;
  mySlider2.valueInterval2 = 100;
  mySlider2.valueDefault2  = parseInt(maxPrice);
  mySlider2.setSliderIcon2('slider.gif', 13, 18);
  mySlider2.useInputField2 = 3;
  mySlider2.styleValueFieldClass2 = 'sliderInput';
  //mySlider2.colorbar2 = new Object({ color:'orange', height:20, widthDifference:-21, offsetLeft:27, offsetTop:37 });
	
  mySlider2.drawInto('sliderDiv2');
	
	
	
  // - Slider 3 -----------------------------------------
  mySlider3 = new Bs_Slider();
  mySlider3.width         = 120;
  mySlider3.height        = 56;
  mySlider3.imgDir   = 'image/';
  mySlider3.setBackgroundImage('bkg_slider.gif', 'no-repeat');
	
	mySlider3.fieldName     = 'slider3_start';
  mySlider3.minVal        = parseInt(defStartYear);
  mySlider3.maxVal        = parseInt(defEndYear);
  mySlider3.valueInterval = 1;
  mySlider3.valueDefault  = parseInt(minYear);
  mySlider3.setSliderIcon('slider.gif', 13, 18);
  mySlider3.useInputField = 3;
  mySlider3.styleValueFieldClass = 'sliderInput';
	
	mySlider3.useSecondKnob        = true;
	mySlider3.preventValueCrossing = true;
	mySlider3.wheelAmount        = 0; //disable mouse wheeling cause we have 2 knobs.
	
	mySlider3.fieldName2     = 'slider3_end';
  mySlider3.minVal2        = parseInt(defStartYear);
  mySlider3.maxVal2        = parseInt(defEndYear);
  mySlider3.valueInterval2 = 1;
  mySlider3.valueDefault2  = parseInt(maxYear);
  mySlider3.setSliderIcon2('slider.gif', 13, 18);
  mySlider3.useInputField2 = 3;
  mySlider3.styleValueFieldClass2 = 'sliderInput';
	
  //mySlider3.colorbar = new Object({ type:'between', color:'red', offsetLeft:6, height:20, offsetTop:37 });
	
  mySlider3.drawInto('sliderDiv3');
}

/**
* @param object sliderObj
* @param int val (the value)
* @param int newPos
* @param int knobNo
*/
function bsSliderChange(sliderObj, val, newPos, knobNumber) { 
	document.getElementById('slider1knob'+knobNumber).value = val;
}
function getInfo(faqID)
{
  $.ajax({
     type: "POST",
     url: "faq_info.php",
     data: "faq_id=" + faqID,
     success: function(msg){
       $("#faqInfo").attr("innerHTML",msg);    
     }
   });
}

function showIssue()
{
  if (trim($('#title').val())!="")
  {
    $.ajax({
       type: "POST",
       url: "get_issues.php",
       data: "title=" + escape($("#title").val()),
       success: function(msg){
         $("#issueno").attr("innerHTML",msg);
       if (trim(msg)!="")
         $("#issueID").css("display","block");    
       }
     });
  }
}

function change_issue(issueVal)
{
  $('#issueField').val(issueVal);
}

function submitInfo()
{ 
    document.getElementById('schar').value=collectInfo('schar');
    document.getElementById('swriter').value=collectInfo('swriter');
    document.getElementById('spencil').value=collectInfo('spencil');
    document.getElementById('sinker').value=collectInfo('sinker');
    document.getElementById('process').value="";
    document.getElementById('pageID').value="";
}

function collectInfo(keyVal)
{
  var keyVals=new Array();
  for(var i=0;i<document.forms['smart_search_result'].elements.length;i++)
  {
    if (document.forms['smart_search_result'].elements[i].name==keyVal)
    {
      if (document.forms['smart_search_result'].elements[i].checked==true)
        keyVals[keyVals.length]=document.forms['smart_search_result'].elements[i].value;
    }
  }
  if (keyVals.length>0)
    return keyVals.join("#|#");
  else
    return "";
}

function SelectAll(keyVal)
{
  for(var i=0;i<document.forms['smart_search_result'].elements.length;i++)
  {
    if (document.forms['smart_search_result'].elements[i].name==keyVal)
      document.forms['smart_search_result'].elements[i].checked=true;
  }
}
function ClearAll(keyVal)
{
  for(var i=0;i<document.forms['smart_search_result'].elements.length;i++)
  {
    if (document.forms['smart_search_result'].elements[i].name==keyVal)
      document.forms['smart_search_result'].elements[i].checked=false;
  }  
}
function ResetAll()
{ 
    document.getElementById('schar').value="";
    document.getElementById('swriter').value="";
    document.getElementById('spencil').value="";
    document.getElementById('sinker').value="";
    document.forms['smart_search_result'].submit();    
}

function fn_SearchBy(keyType,keyValue)
{
    document.getElementById('schar').value="";
    document.getElementById('swriter').value="";
    document.getElementById('spencil').value="";
    document.getElementById('sinker').value="";
    document.getElementById('process').value="";
    document.getElementById('pageID').value="";
    switch (keyType)
    {
      case 'character':
        document.getElementById('schar').value=unescape(keyValue);
        break;
      case 'writer':
        document.getElementById('swriter').value=unescape(keyValue);
        break;
      case 'penciller':
        document.getElementById('spencil').value=unescape(keyValue);
        break;
      case 'inker':
        document.getElementById('sinker').value=unescape(keyValue);
        break;                        
    }
    document.forms['smart_search_result'].submit();
/*    document.getElementById('skeysearch').value=keyValue;
    document.getElementById('ssearchtype').value=keyType;    
    document.forms['searchBy'].submit();
*/    
}

function sProcess(proVal)
{
  document.getElementById('process').value=proVal;
  document.forms['smart_search_result'].submit();  
}
//added by smartdata on 13 oct end here


function showInputBox(optionValue, Type)
{
	switch(Type)
	{
		case 1:
			showTextBox(optionValue, "showTextBox", "other_story_page_number");
			document.getElementById("showLineUp").innerHTML = optionValue;
			document.getElementById("line_up_page_number").value = optionValue;
			showTextBox(optionValue, "showLineUpTextBox", "other_line_up_page_number");
                        showTextBox(optionValue, "showTextBox", "other_story_page_number");
			break;
		case 2:
			showTextBox(optionValue, "showLineUpTextBox", "other_line_up_page_number");
			break;
		case 3:
			showTextBox(optionValue, "pageSizeTextBox", "other_page_size");
			break;
		case 4:
			showTextBox(optionValue, "artSizeTextBox", "other_art_size");
			break;
		case 5:
			showTextBox(optionValue, "sequenceTextBox", "sequence_title");
			break;
    case 6:
			showTextBox(optionValue, "priceTextBox", "price");
			break;
		default:
			return true;
	}
}
function showTextBox(optionValue, div, field)
{
	if(optionValue=="Other")
	{
		document.getElementById(div).style.display="block";
		document.getElementById(field).focus();		
	}
	else if(optionValue=="Page Number")
	{
		document.getElementById(div).style.display="block";
		document.getElementById(field).focus();
	}
        else if(optionValue==1)
	{
		document.getElementById(div).style.display="block";
		document.getElementById(field).focus();
	}
	else
	{
		document.getElementById(div).style.display="none";	
	}
}

function checkSelItems()
{
  var flag=false;
  for(var i=0;i<document.forms['wishlist_form'].elements.length;i++)
  {
      if (document.forms['wishlist_form'].elements[i].type=="checkbox")
      {
        if (document.forms['wishlist_form'].elements[i].checked==true)
          flag=true;
      }
  }
  if (flag==false)
    alert("Select product(s) to put them in cart..");
  return flag;
}