/*------------------------------------------------------------------------*/
//  ¾÷¹«±¸ºÐ      : °øÅë
//  ¼¼ºÎ¾÷¹« ±¸ºÐ : ÀÚÁÖ»ç¿ëÇÏ´Â ½ºÅ©¸³Æ® ¸ðÀ½
//  ÇÁ·Î±×·¡¸í    : CommPrototype.js
//  °³¹ßÀÚ        : °­¼º¸ð
//  °³¹ßÀÏ        : 2005. 10. 24
//  °³¹ß³»¿ë      : °³¹ß½Ã ÀÚÁÖ »ç¿ëÇÏ´Â Javascript ¸ðÀ½
/*------------------------------------------------------------------------*/



// ÇÃ·¡½Ã ActiveX ¼öÁ¤
function swf(src, w, h)
{
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="param" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="'+src+'">';
	html += '<param name="quality" value="high">';	
	html += '<param name="wmode" value="transparent">';
	html += '<param name="menu" value="0">';
	html += '<embed src="'+src+'" menu="false" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'"  height="'+h+'"><\/embed>';
	html += '<\/object>';
	document.write(html);
}


// Á¡¼±¾ø¾Ö±â

function allblur() {
	for (i = 0; i < document.links.length; i++)
	document.links[i].onfocus = document.links[i].blur;
}


// ¼º¸ð
String.prototype.trim = function() {
  return this.replace(/(^\s*)|(\s*$)|($\s*)/g, "");
}

String.prototype.isid = function() {
  if (this.search(/[^A-Za-z0-9_-]/) == -1)
	 return true;
  else 
	 return false;
}

String.prototype.isalpha = function() {
  if (this.search(/[^A-Za-z]/) == -1)
	 return true;
  else
	 return false;
}

String.prototype.isnumber = function() {
  if (this.search(/[^0-9]/) == -1)
	 return true;
  else
	 return false;
}

String.prototype.isemail = function() {
  var flag, md, pd, i;
  var str;

  if ( (md = this.indexOf("@")) < 0 )
	 return false;
  else if ( md == 0 )
	 return false;
  else if (this.substring(0, md).search(/[^.A-Za-z0-9_-]/) != -1)
	 return false;
  else if ( (pd = this.indexOf(".")) < 0 )
	 return false;
  else if ( (pd + 1 )== this.length || (pd - 1) == md )
	 return false;
  else if (this.substring(md+1, this.length).search(/[^.A-Za-z0-9_-]/) != -1)
	 return false;
  else
	 return true;
}

String.prototype.korlen = function() {
  var temp;
  var set = 0;
  var mycount = 0;
  
  for( k = 0 ; k < this.length ; k++ ){
	 temp = this.charAt(k);
  
	 if( escape(temp).length > 4 ) {
		mycount += 2; 
	 }
	 else mycount++;
  }

  return mycount;
}

String.prototype.isssn = function() {
  
  var first  = new Array(6);
  var second = new Array(7);
  var total = 0;
  var tmp = 0;
  
  if ( this.length != 13 )
	 return false;
  else {
	 for ( i = 1 ; i < 7 ; i++ )
		first[i] = this.substring(i - 1, i);
  
	 for ( i = 1 ; i < 8 ; i++ )
		second[i] = this.substring(6 + i - 1, i + 6);
  
	 for ( i = 1 ; i < 7 ; i++ ) {
		if ( i < 3 )
		   tmp = Number( second[i] ) * ( i + 7 );
		else if ( i >= 3 )
		   tmp = Number( second[i] ) * ( ( i + 9 ) % 10 );
	 
		total = total + Number( first[i] ) * ( i + 1 ) + tmp;
	 }
  
	 if ( Number( second[7] ) != ((11 - ( total % 11 ) ) % 10 ) ) 
		return false;
  }
  return true;
}

String.prototype.bytes = function() {
	var str = this;
	var l = 0;
	for (var i=0; i<str.length; i++) l += (str.charCodeAt(i) > 128) ? 2 : 1;
	return l;
}

String.prototype.replaceAll = function(oldValue, newValue) {
	
	var retValue = this;
	
	while (retValue.indexOf(oldValue) >= 0)
	{
		retValue = retValue.replace(oldValue, newValue);
	}
	
	return retValue;
}

String.prototype.divDecimal = function(index)
{
	var value = this;
	var pos = String(value).indexOf('.');

	if (pos > 0 && String(value).length > pos + index)
	{
		value = String(value).substring(0, pos + index);
	}
	
	return value;				
}

//body oncontextmenu="return false" onselectstart="return false" ondragstart="return false"

//ÀÌ¹ÌÁöÆË¾÷ Ãß°¡-juny421

function CaricaFoto(img){
foto1= new Image();
foto1.src=(img);
Controlla(img);
}
function Controlla(img){
if((foto1.width!=0)&&(foto1.height!=0)){
viewfoto(img);
}
else{
funzione="Controlla('"+img+"')";
intervallo=setTimeout(funzione,20);
}
}
function viewfoto(img){
largh=foto1.width+0;
altez=foto1.height+0;
stringa="width="+largh+",height="+altez;
finestra=window.open('./photoview.php?photosrc=' + img,"",stringa);
}

