//ISB for patent search
//copyright IPEXL. 2006
//August 2006 1a

document.writeln('<style type="text/css">');
var sApplicationHost = "http://www.surfip.gov.sg";


//style for main border
    document.writeln('.mainTableBorder {');
    document.writeln('border-width: 1px;');
    document.writeln('border-style: solid;');
    document.writeln('border-color: #666666;');
    document.writeln('}');



//style for checkboxes
document.writeln('.chkBoxText {');
		//document.writeln('font-family: Arial,Verdana,Tahoma,sans-serif;');
		document.writeln('color:#000000');
		//document.writeln('font-size: 10px');
		document.writeln('bgcolor: #D9ECFF');
		document.writeln('width: 25%');
	document.writeln('}');


	    

	
document.writeln('</style>');   




document.writeln('<form method="get" name="frmSearchP" id="frmSearchP" target="_new"  action="'+sApplicationHost+'/_isb/search/patentSearch.jsp">');
document.writeln('<table class="mainTableBorder" background="'+sApplicationHost +'/_isb/img/bg-isb-sip.gif" cellpadding="0" style="border-collapse: collapse" width="470" id="table1"> ');
	document.writeln('<tr align="right">');
	document.writeln('<td>');
      		document.writeln('<table width="88" height="62" border="0" cellspacing="0" cellpadding="0">');
          		document.writeln('<tr><td width="88" height="45"><a href="'+sApplicationHost +'" target="_blank"><img alt="Visit SurfIP.gov.sg for all your custom IP searching" border="0" src="'+sApplicationHost +'/_isb/img/bg-isb-sip_logo.gif"></a></td></tr>');
		document.writeln('</table>');
	document.writeln('</td>');


	document.writeln('<td valign="top">');
		document.writeln('<table cellpadding="0" style="border-collapse: collapse">');
			document.writeln('<tr>');
			document.writeln('<td>');
				document.writeln('<input name="textSearchText" id="textSearchText" onkeypress="fnValidP()" size="43" style="float: left" >');
			document.writeln('</td>');
			
			document.writeln('<td>');
				document.writeln('<td class="chkBoxText" >&nbsp;</td>');
			document.writeln('</td>');
			
			document.writeln('<td>');
				document.writeln('<input type="hidden" name="type" id="searchType" value="patents"> </input>');			
			document.writeln('</td>');
			
			
			document.writeln('<td>');
				document.writeln('<td class="chkBoxText" >&nbsp;</td>');
			document.writeln('</td>');
			
			document.writeln('<td>');
				document.writeln('<input name="btnGO" id="btnGO" value="Search" type="image" src="'+sApplicationHost +'/_isb/img/g-search_pt.gif" onclick="fnPostP()"/>');
			document.writeln('</td>');
			
			document.writeln('</tr>');
				
			document.writeln('<tr>');
				document.writeln('<table border="0" cellpadding="0" style="border-collapse: collapse" width="380" id="table2">');

				document.writeln('<tr>');
				//document.writeln('<td class="chkBoxText"> ');
				document.writeln('<td style="font-family: Arial; font-size:11px" > ');
				document.writeln('<input  id="chkbx_all_patent" name="chkbx_all_patent" value="all" type="checkbox" checked onclick="fnCheckOrUnCheckAllDataSourceP()"/>');
				document.writeln('<b>All</b></td>');

				document.writeln('<td style="font-family: Arial; font-size:11px" >&nbsp;&nbsp;&nbsp;</td>');

				document.writeln('<td style="font-family: Arial; font-size:11px" ><input id="chkDSIPOS" name="chkDSIPOS" value="ipos" type="checkbox" checked onclick="fnUncheckAllCheckboxP()">');
				document.writeln('<b>Singapore</b></td>');
				
				document.writeln('<td style="font-family: Arial; font-size:11px" ><input id="chkDSCIPO" name="chkDSCIPO" value="cipo" type="checkbox" checked onclick="fnUncheckAllCheckboxP()"> ');
				document.writeln('<b>Canada</b></td>');
				
				document.writeln('<td style="font-family: Arial; font-size:11px" ><input id="chkDSSIPO" name="chkDSSIPO" value="sipo" type="checkbox" checked onclick="fnUncheckAllCheckboxP()">');
				document.writeln('<b>China</b></td>');
				
				document.writeln('<td style="font-family: Arial; font-size:11px" >&nbsp;&nbsp;&nbsp;</td>');

				document.writeln('<td style="font-family: Arial; font-size:11px" ><input id="chkDSTIPO" name="chkDSTIPO" value="tipo" type="checkbox" checked onclick="fnUncheckAllCheckboxP()">');
				document.writeln('<b>Taipei</b></td>');

			
			document.writeln('</tr>');

			document.writeln('<tr>');
				document.writeln('<td style="font-family: Arial; font-size:11px" >&nbsp;</td>');
				document.writeln('<td style="font-family: Arial; font-size:11px" >&nbsp;&nbsp;&nbsp;</td>');

				document.writeln('<td style="font-family: Arial; font-size:11px" ><input id="chkDSEPO" name="chkDSEPO" value="epo" type="checkbox" checked onclick="fnUncheckAllCheckboxP()">');
				document.writeln('<b>Europe</b></td>');
				
				document.writeln('<td style="font-family: Arial; font-size:11px" ><input id="chkDSUKPO" name="chkDSUKPO" value="ukpo" type="checkbox" checked onclick="fnUncheckAllCheckboxP()"> ');
				document.writeln('<b>UK</b></td>');
				
				document.writeln('<td style="font-family: Arial; font-size:11px" ><input id="chkDSJPO" name="chkDSJPO" value="jpo" type="checkbox" checked onclick="fnUncheckAllCheckboxP()">');                                     
				document.writeln('<b>Japan</b></td>');	
				
				document.writeln('<td style="font-family: Arial; font-size:11px" >&nbsp;&nbsp;&nbsp;</td>');

				document.writeln('<td style="font-family: Arial; font-size:11px" ><input id="chkDSTIPIC" name="chkDSTIPIC" value="tipic" type="checkbox" checked onclick="fnUncheckAllCheckboxP()">');
				document.writeln('<b>Thailand</b></td>');

			document.writeln('</tr>');

			document.writeln('<tr>');
				document.writeln('<td style="font-family: Arial; font-size:11px" >&nbsp;</td>');

				document.writeln('<td style="font-family: Arial; font-size:11px" >&nbsp;&nbsp;&nbsp;</td>');

				document.writeln('<td style="font-family: Arial; font-size:11px" ><input id="chkDSWIPO" name="chkDSWIPO" value="wipo" type="checkbox" checked onclick="fnUncheckAllCheckboxP()">');                                     
				document.writeln('<b>PCT</b></td>');

				document.writeln('<td style="font-family: Arial; font-size:11px" ><input id="chkDSUSPTO" name="chkDSUSPTO" value="uspto" type="checkbox" checked onclick="fnUncheckAllCheckboxP()">');
				document.writeln('<b>US-PatFT</b></td>');
	
				document.writeln('<td style="font-family: Arial; font-size:11px" ><input id="chkDSKIPO" name="chkDSKIPO" value="kipo" type="checkbox" checked onclick="fnUncheckAllCheckboxP()"> ');
				document.writeln('<b>Korea</b></td>');
				
				document.writeln('<td style="font-family: Arial; font-size:11px" >&nbsp;&nbsp;&nbsp;</td>');

				document.writeln('<td style="font-family: Arial; font-size:11px" ><input id="chkDSPM" name="chkDSPM" value="pm" type="checkbox" checked onclick="fnUncheckAllCheckboxP()">');
				document.writeln('<b>PatentMaps</b></td>');			

				//document.writeln('<td style="font-family: Arial; font-size:11px" >&nbsp;</td>');
			document.writeln('</tr>');

		document.writeln('</table>');
		document.writeln('</tr>');

	document.writeln('</table>');





document.writeln('</table>');
document.writeln('</td>');
document.writeln('</tr>');



document.writeln('</table>');
document.writeln('</form>');




function fnUncheckAllCheckboxP(){

      var formP = document.frmSearchP.elements;
      var iNoElements = formP.length;
	  var allFlag = true;

      for(i=0;i<iNoElements;i++)
      {
		var sfivechars	= String(formP[i].name).substring(0,5);
		if (sfivechars == "chkDS"){
			if(formP[i].checked == false)
				allFlag = false;
		}
      } //end of for
      
      document.getElementById('chkbx_all_patent').checked = allFlag;
}


function  fnCheckOrUnCheckAllDataSourceP()
{

      var formP = document.frmSearchP.elements;
      var iNoElements = formP.length;

      var bAllChecked = true;
   
  

      for(i=0;i<iNoElements;i++)
      {

            
		if (formP[i].name == "chkbx_all_patent") {
			bAllChecked = formP[i].checked
		}
     
		var sfivechars	= String(formP[i].name).substring(0,5);
		if (sfivechars == "chkDS"){
			if (bAllChecked){
				formP[i].checked = true;
			}
			else{
				formP[i].checked = false;
			}


	        }

       } //end of for



} //end of fnCheckOrUnCheckAllDataSourceP()


function fnPostP(){
      document.frmSearchP.submit();
}


function fnValidateP()
{

  var ErrMsg=false


    if(!ErrMsg)
    {

      USPTOTabLoaded=false;
      WIPOTabLoaded=false;
      IPOSTabLoaded=false;
      SIPOTabLoaded=false;
      EPOTabLoaded=false;
      CIPOTMTabLoaded=false;


      document.frmSearchP.submit();

    }
}

function fnValidP()
{
  if(event.keyCode!=13)
  {
      valChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890?()* \"\'"
      var isValid=false
      for(i=0;i<valChars.length;i++) {
        if(valChars.charAt(i) ==String.fromCharCode(event.keyCode))
        {
          event.returnValue = true
          isValid=true
          break
        }
      }
      if(!isValid)
      event.returnValue = false
  }
  else
  {
    event.returnValue = false
      fnValidateP()
  }
}

