function openWin(theValueI, theValueII) {
  var theWin = 'width=270,height=246,resizable=no,status=no,scrollbars=no'
  window.open('bigimage.asp?c='+theValueI+'&p='+theValueII,"Windows",theWin)
}
function openPrintWin(theWidth,theHeight,FileName) {
  var theWin = 'width=' + theWidth + ',height='+ theHeight + ',resizable=no,status=no,scrollbars=yes'
  window.open(FileName,"Windows",theWin)
}
function openMuadil(theValueI) {
  var theWin = 'width=270,height=140,resizable=no,status=no,scrollbars=no'
  window.open('muadil.asp?p='+theValueI,"Windows",theWin)
}

function openGift(theValueI, theValueII, theValueIII) {
  var theWin = 'width=290,height=290,resizable=no,status=no,scrollbars=no'
  window.open('giftofgift.asp?c='+theValueI+'&p='+theValueII+'&g='+theValueIII,"Windows",theWin)
}

function CheckForm(){
  var message = ""
  if (document.eventform.minpoint.value == "" && document.eventform.maxpoint.value != "") {document.eventform.minpoint.value = 0}

  var checkStrMin = document.eventform.minpoint.value;
  if (!isValidString(checkStrMin, "0123456789")){
    message = "Lütfen yalnız rakam giriniz.";
  }

  var checkStrMax = document.eventform.maxpoint.value;  
  if (!isValidString(checkStrMax, "0123456789")){
    message = "Lütfen yalnız rakam giriniz.";
  }
    
  if (checkStrMin == "" && checkStrMax == ""){
	message = "PUAN?";}
  else
  {
    if (isValidString(checkStrMin, "0123456789") && isValidString(checkStrMax, "0123456789")){
      if (document.eventform.minpoint.value != "" && document.eventform.maxpoint.value != ""){
        theZero = document.eventform.maxpoint.value - document.eventform.minpoint.value;
	if (theZero < 0){
	  message = "Bu şekilde sorgulama yapamazsınız.\nLütfen girdiğiniz rakamları kontrol ediniz.";
          //message = message + "M: " + document.eventform.minpoint.value + " X: " + document.eventform.maxpoint.value;
	}
	else {
	  theSub = document.eventform.maxpoint.value - document.eventform.minpoint.value;
	  if (theSub > 10000){
	    message = "Min. ve Max. girdiğiniz rakamların arasındaki fark en fazla 10.000 olabilir";
	  }
	}
      }
    }
  }
      	    
  if (message != "") {
	alert(message);
	message = "";
	return false;
  }

document.eventform.PSearch.disabled = true;
return true;
}


function selectAllBox() {
var theCounter = document.findform.length - 1
//var theCounter = document.findform.catcount.value;

  if (document.findform.allcat.checked) {
    for(i=1; i<=theCounter; i++){
      theEval = eval("document.findform." + document.findform[i].name);
      theEval.checked = true;
    }
  }
  else {
    for(i=1; i<=theCounter; i++){
      theEval = eval("document.findform." + document.findform[i].name);
      theEval.checked = false;
    }
  }
}


function CheckFindForm(){
  var message = ""
  if (document.findform.minpoint.value == "" && document.findform.maxpoint.value != "") {document.findform.minpoint.value = 0}

  var checkStrMin = document.findform.minpoint.value;
  if (!isValidString(checkStrMin, "0123456789")){
    message = "Lütfen Min ve Max bölümlere yalnız rakam giriniz.";
  }

  var checkStrMax = document.findform.maxpoint.value;
  if (!isValidString(checkStrMax, "0123456789")){
    message = "Lütfen Min ve Max bölümlere yalnız rakam giriniz.";
  }
    
  if (document.findform.minpoint.value == "" && document.findform.maxpoint.value == "" && document.findform.word.value == ""){
	message = "PUAN veya anahtar kelime?";}
  else
  {
    if (isValidString(checkStrMin, "0123456789") && isValidString(checkStrMax, "0123456789")){
	  if (document.findform.minpoint.value != "" && document.findform.maxpoint.value != ""){
            theZero = document.findform.maxpoint.value - document.findform.minpoint.value;
	    if (theZero < 0){
	    message = "Bu şekilde sorgulama yapamazsınız.\nLütfen girdiğiniz rakamları kontrol ediniz.";
	    }
	    else {
	      theSub = document.findform.maxpoint.value - document.findform.minpoint.value
	      if (theSub > 10000){
	        message = "Min. ve Max. girdiğiniz rakamların arasındaki fark en fazla 10.000 olabilir";
	      }
	    }
	  }
	}
  }
      	    
  if (message != "") {
	alert(message);
	message = "";
	return false;
  }

document.findform.BFind.disabled = true;
return true;
}

function openWinPro(theValueII,theValue) {
  var theWin = 'width=460,height=151,resizable=no,status=no,scrollbars=no'
  window.open('product.asp?id='+theValue+'&cat='+theValueII,"Windows",theWin)
}


function CheckPointForm() {
  var message = ""

  var checkNumStr = document.smartpoint.number.value;
  if (!isValidString(checkNumStr, "0123456789")){
    message = "Lütfen numara bölümüne yalnız rakam giriniz.";
  }
  else {
    if (checkNumStr.length != 9){
      message = "Lütfen kart numaranızı kontrol ediniz.";
    }
  }

  var checkStr = document.smartpoint.password.value;  
  if (!isValidString(checkStr, "0123456789")){
    message = message + "\nLütfen şifre bölümüne yalnız rakam giriniz.";
  }
  else {
    if (checkStr.length != 4){
      message = message + "\nLütfen şifrenizi kontrol ediniz.";
    }
  }
  
  if (message != "") {
	alert(message);
	message = "";
	return false;
  }

document.smartpoint.pointer.disabled = true;
return true;
}



function isValidString(checkStr, checkOK) {
  decPoints = 0;
  allNum = "";

  for (i = 0;  i < checkStr.length;  i++){
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length){
      return false;
    }
    allNum += ch;
  }
return true;
}


function initExpCol(){
  tempColl = document.all.tags("div");
  for (i=0; i<tempColl.length; i++) {
    if (tempColl(i).className == "ExpCol") ExpCollapse(tempColl(i).id);
  }
}

var vheight=null;
function ExpCollapse(vd){
  var vx = document.getElementById(vd);
  if(vheight==null)vheight=vx.style.height;
  vx.style.visibility=vx.style.visibility=="hidden"?"visible":"hidden";
  vx.style.overflow=vx.style.overflow=="hidden"?"visible":"hidden";
  vx.style.height=vx.style.height=="1px"?"1em":"1px";
}



function checkDate(vDate) {
  var vError = false;
  //var vDate = "06/11/2002-04/12/2002"
  var vYYYYf, vMMf, vDDf, vYYYYs, vMMs, vDDs
  if (!isNaN(vDate.substring(0, 2))) {
    theString = parseInt(vDate.substring(0, 2));
  
    if (theString < 1 || theString > 31) {
      vError = true;
    }
    else {
      if (theString < 10) {theString = "0" + theString}
      vDDf = theString;
    }
  }
  else {
    vError = true;
  }

  if (!isNaN(vDate.substring(3, 5))) {
    theString = parseInt(vDate.substring(3, 5));
    if (theString < 1 || theString > 12) {
      vError = true;
    }
    else {
      theString = theString - 1;
      if (theString < 10) {theString = "0" + theString}
      vMMf = theString;
    }
  }
  else {
    vError = true;
  }

  if (!isNaN(vDate.substring(6, 10))) {
    theString = parseInt(vDate.substring(6, 10))
    if (theString > 2001) {
      vYYYYf = theString;
    }
    else {
      vError = true;
    }
  }
  else {
    vError = true;
  }

  if (!isNaN(vDate.substring(11, 13))) {
    theString = parseInt(vDate.substring(11, 13));
  
    if (theString < 1 || theString > 31) {
      vError = true;
    }
    else {
      if (theString < 10) {theString = "0" + theString}
      vDDs = theString;
    }
  }
  else {
    vError = true;
  }

  if (!isNaN(vDate.substring(14, 16))) {
    theString = parseInt(vDate.substring(14, 16));
    if (theString < 1 || theString > 12) {
      vError = true;
    }
    else {
      theString = theString - 1;
      if (theString < 10) {theString = "0" + theString}
      vMMs = theString;
    }
  }
  else {
    vError = true;
  }

  if (!isNaN(vDate.substring(17, 21))) {
    theString = parseInt(vDate.substring(17, 21))
    if (theString > 2001) {
      vYYYYs = theString;
    }
    else {
      vError = true;
    }
  }
  else {
    vError = true;
  }

  if (vError) {
    return true;
  }
  else {
    //  new Date(YYYY, MM, DD, hh, mm, ss)
    f = new Date(vYYYYf, vMMf, vDDf, 00, 00, 01)
    s = new Date(vYYYYs, vMMs, vDDs, 00, 00, 00)
    diff = s - f    					 //difference in milliseconds
    vMTG = new String(diff/86400000)   //calculate days and convert to string
    vPoint = vMTG.indexOf(".")         //find the decimal point
    vDays = parseInt(vMTG.substring(0, vPoint)) + 1
    //document.write(f + "<br>")
    //document.write(s + "<br>")
    if (vDays != 28){
      return true;
    }
    else {
      return false;
    }
  }
}