﻿// JavaScript Document
function setPng24(obj) {
  obj.width=obj.height=1;
  obj.className=obj.className.replace(/\bpng24\b/i,'');
  obj.style.filter =
  "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');";
  obj.src=''; 
  return '';
}
function bluring(){ 
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") 

document.body.focus(); 
} 
document.onfocusin=bluring; 

function make_swf(swf_url,swf_width,swf_height,swf_bg,swf_wmode,swf_flashvars){
  document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.c-ab#version=8,0,0,0\" width=\""+swf_width+"\" height=\""+swf_height+"\" id=\"external_flash\">");
        document.write("<param name=\"movie\" value=\""+swf_url+"\">");
        document.write("<param name=\"quality\" value=\"high\">");
        document.write("<param name=\"menu\" value=\"false\">");
 document.write("<param name=\"allowScriptAccess\" value=\"always\">");
   if(swf_flashvars!=""){
        document.write("<param name=\"flashVars\" value=\""+swf_flashvars+"\">");
   }
   if(swf_wmode!=""){
   document.write("<param name=\"wmode\" value=\""+swf_wmode+"\">");
   }
   document.write("<param name=\"base\" value=\".\">");
  document.write("<embed src=\""+swf_url+"\" base=\".\" bgcolor=\""+swf_bg+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\""+swf_width+"\" height=\""+swf_height+"\" allowScriptAccess=\"always\" swLiveConnect=\"true\" name=\"external_flash\"></embed>");
  document.write("</object>");

 }
function addCommas(strValue){ 
var objRegExp = new RegExp('(-?[0-9]+)([0-9]{3})'); 
  while(objRegExp.test(strValue)) { 
  strValue = strValue.replace(objRegExp, '$1,$2'); 
  } 
return strValue; 
} 
 
 $(function() {
//		var id = $("#id");
		var address = $("#address");
//		var idcheck = $("#idcheck");
//		var company = $("#company");
//		var no = $("#no");
//
		function checkLength(o,n,min,max) {
			if ( o.val().length > max || o.val().length < min ) {
				alert(n+" "+min+"자 이상 "+max+"자 이하로 입력해 주세요.");
				$(o).focus();
				return false;
			} else {
				return true;
			}

		}
//
//		$('#search').click(function() {
//
//			 $.ajax({
//			   type: "POST",
//			   url: "php/msearch.php",
//			   data: "area="+$("#area :selected").val()+"&part="+$("#part :selected").val()+"&company="+company.val(),
//			   success: function(html){
//				   //$("#list").val()="";
//				   $("#list").html(html);
//			   }
//			 });
//
//		});
//
//		$('#checkid').click(function() {
//			if(checkLength(id,"아이디는",4,16)){
//			idcheck.val(1);
//			 $.ajax({
//			   type: "POST",
//			   url: "php/checkid.php",
//			   data: "id="+id.val(),
//			   success: function(msg){
//				 alert( msg );
//			   }
//			 });
//			}
//		});
//		
		$('#zipsearch').click(function() {
			if(checkLength(address,'검색하실 내용을',2,16)){
			 $.ajax({
			   type: "POST",
			   url: "../zipcode/exec.php",
			   data: "address="+address.val(),
			   success: function(html){
				   $("#results").html(html);
			   }
			 });
			}
		});
//		
});

	function getCookie(NameCookie)
	{
		var i = document.cookie.indexOf(NameCookie + '=' );
		if (i != -1) {
			i += NameCookie.length + 1;
			NameEnd = document.cookie.indexOf(';', i);
			if (NameEnd == -1){
				NameEnd = document.cookie.length;
			}
			return  unescape(document.cookie.substring(i, NameEnd));
		} else {
			return "";
		}
	}

	function setCookie( name, value, expiredays )
	{
		var todayDate = new Date();
		todayDate.setDate( todayDate.getDate() + expiredays );
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
	}
